<?php

namespace App\Models;

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

class ContractConfig extends Model
{
    use HasFactory;

    protected $fillable = [
        'contract_type_id',
        'segment_id',
        'is_initial',
        'active',
    ];

    protected function casts(): array
    {
        return [
            'active' => 'boolean',
            'is_initial' => 'boolean',
        ];
    }

    public function type(): BelongsTo
    {
        return $this->belongsTo(ContractType::class, 'contract_type_id');
    }

    public function segment(): BelongsTo
    {
        return $this->belongsTo(Segment::class, 'segment_id');
    }
}
