<?php

namespace App\Models;

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

class DirectorAppointment extends Model
{
    use HasFactory;

    /**
     * The attributes that are mass assignable.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'company_id',
        'director_id',
        'date_of_appointment',
        'date_of_ceasing',
        'remarks',
    ];

    /**
     * The attributes that should be cast.
     *
     * @var array<string, string>
     */
    protected $casts = [
        'date_of_appointment' => 'date',
        'date_of_ceasing' => 'date',
    ];

    /**
     * Get the company that owns the appointment.
     */
    public function company(): BelongsTo
    {
        return $this->belongsTo(Company::class);
    }

    /**
     * Get the director that owns the appointment.
     */
    public function director(): BelongsTo
    {
        return $this->belongsTo(Director::class);
    }
}