<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class MatterClient extends Model
{
    protected $table = 'matter_clients';

    protected $fillable = [
        'matter_id',
        'client_id',
        'role_id',
        'is_primary_client',
        'created_by',
        'updated_by',
    ];

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

    public function matter()
    {
        return $this->belongsTo(Matter::class, 'matter_id');
    }

    public function client()
    {
        return $this->belongsTo(Client::class, 'client_id');
    }

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