<?php

namespace App\Models\ESign;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class EsignAuditLog extends Model
{
    protected $table = 'esign_audit_logs';

    public $timestamps = false;

    protected $fillable = [
        'tenant_id',
        'contract_id',
        'signer_id',
        'action',
        'ip_address',
        'user_agent',
        'metadata',
        'created_at',
    ];

    protected $casts = [
        'metadata' => 'array',
        'created_at' => 'datetime',
    ];

    public function contract(): BelongsTo
    {
        return $this->belongsTo(EsignContract::class, 'contract_id');
    }

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