<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class CaseParty extends Model
{
    protected $primaryKey = 'case_party_id';

    protected $keyType = 'int';

    public $incrementing = true;

    protected $fillable = [
        'case_id',
        'client_id',
        'party_name',
        'party_type',
        'contact_info',
        'email',
        'phone',
        'address',
        'role_id',
        'notes',
        'is_active',
        'created_by',
        'updated_by',
    ];

    protected $casts = [
        'is_active' => 'boolean',
    ];

    public function legalCase()
    {
        return $this->belongsTo(LegalCase::class, 'case_id', 'id');
    }

    public function caseRole()
    {
        return $this->belongsTo(CaseRole::class, 'role_id', 'role_id');
    }
}
