<?php

namespace App\Models;

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

final class Contract extends Model
{
    use HasPublicId;

    protected $table = 'contracts';

    protected $fillable = [
        'public_id',
        'company_id',
        'branch_id',
        'party_id',
        'contract_number',
        'title',
        'contract_type',
        'start_date',
        'end_date',
        'notice_period_days',
        'billing_cycle',
        'payment_terms_days',
        'credit_limit',
        'currency_code',
        'tax_code_id',
        'deposit_amount',
        'retention_percentage',
        'auto_renewal',
        'status',
        'signed_date',
        'signed_by',
        'terms',
        'internal_notes',
        'created_by',
    ];

    protected function casts(): array
    {
        return ['start_date'=>'date', 'end_date'=>'date', 'signed_date'=>'date', 'credit_limit'=>'decimal:4', 'deposit_amount'=>'decimal:4', 'retention_percentage'=>'decimal:4', 'auto_renewal'=>'boolean'];
    }
}
