<?php

namespace App\Models;

use App\Models\Concerns\HasPublicId;
use Illuminate\Database\Eloquent\Model;

final class Driver extends Model
{
    use HasPublicId;

    protected $table = 'drivers';

    protected $fillable = [
        'public_id',
        'company_id',
        'branch_id',
        'party_id',
        'assigned_vehicle_id',
        'driver_code',
        'name',
        'phone',
        'email',
        'employment_type',
        'driving_license_number',
        'license_expiry',
        'visa_expiry',
        'emirates_id_expiry',
        'passport_expiry',
        'salary_or_rate',
        'per_trip_allowance',
        'bank_details',
        'is_active',
        'notes',
    ];

    protected function casts(): array
    {
        return ['license_expiry'=>'date', 'visa_expiry'=>'date', 'emirates_id_expiry'=>'date', 'passport_expiry'=>'date', 'salary_or_rate'=>'decimal:4', 'per_trip_allowance'=>'decimal:4', 'is_active'=>'boolean'];
    }
}
