<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class SmsTemplate extends Model
{
    use HasFactory;

    protected $table = 'sms_templates';

    protected $fillable = [
        'uuid',
        'name',
        'slug',
        'content',
        'variables_json',
        'is_active',
        'default_profile_id',
        'default_sender_id',
        'allow_custom_body',
        'action_id',
        'decision_id',
    ];

    protected $casts = [
        'is_active' => 'boolean',
        'variables_json' => 'array',
        'allow_custom_body' => 'boolean',
    ];

    public function defaultProfile()
    {
        return $this->belongsTo(SmsProfile::class, 'default_profile_id');
    }

    public function defaultSender()
    {
        return $this->belongsTo(SmsSender::class, 'default_sender_id');
    }

    public function action()
    {
        return $this->belongsTo(Action::class);
    }

    public function decision()
    {
        return $this->belongsTo(Decision::class);
    }
}
