<?php

namespace App\Models;

use App\Models\Concerns\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;

class WaTemplate extends Model
{
    use BelongsToTenant;

    protected $table = 'wa_templates';

    protected $fillable = ['tenant_id', 'key', 'body_ar', 'body_en', 'enabled'];

    protected function casts(): array
    {
        return ['enabled' => 'boolean'];
    }

    public function body(string $locale): string
    {
        return $locale === 'ar' ? $this->body_ar : $this->body_en;
    }
}
