<?php

namespace App\Models;

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

class ApprovalAssignment extends BaseModel
{
    use HasFactory;

    protected $fillable = [
        'approval_id',
        'user_id',
        'sequence',
        'status',
        'actioned_at',
        'is_final',
    ];

    protected $casts = [
        'actioned_at' => 'datetime',
        'status' => 'string',
    ];

    /**
     * Get the approval this assignment belongs to.
     */
    public function approval()
    {
        return $this->belongsTo(Approval::class);
    }

    /**
     * Get the user (approver) assigned to this approval.
     */
    public function user()
    {
        return $this->belongsTo(User::class);
    }
}

