<?php

declare(strict_types=1);

namespace ImovelZapAi\Signatures\Infrastructure\Persistence\Eloquent;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use ImovelZapAi\Shared\Infrastructure\Persistence\Concerns\BelongsToTenant;
use ImovelZapAi\Shared\Infrastructure\Persistence\Concerns\HasUuidPrimaryKey;

class SignatureReminderModel extends Model
{
    use BelongsToTenant;
    use HasUuidPrimaryKey;

    protected $table = 'signature_reminders';

    protected $fillable = [
        'tenant_id', 'signature_request_id', 'signer_id', 'channel',
        'scheduled_at', 'sent_at', 'status',
    ];

    protected function casts(): array
    {
        return [
            'scheduled_at' => 'datetime',
            'sent_at' => 'datetime',
        ];
    }

    public function request(): BelongsTo
    {
        return $this->belongsTo(SignatureRequestModel::class, 'signature_request_id');
    }

    public function signer(): BelongsTo
    {
        return $this->belongsTo(SignerModel::class, 'signer_id');
    }
}
