<?php

namespace Kylin\LawCase\Models;

use Illuminate\Database\Eloquent\Model;
use Kylin\LawCase\Enums\ConflictCheckStatus;

/**
 * 冲突检索模型
 *
 * 管理利益冲突检索记录，确保案件代理合规。
 *
 * @property string $check_result         检索结果
 * @property string $check_detail         检索详情
 * @property string $conflicting_parties  冲突方
 */
class ConflictCheck extends Model
{
    protected $table = 'kylin_law_conflict_checks';

    protected $fillable = [
        'case_id',
        'client_id',
        'check_result',
        'check_detail',
        'conflicting_parties',
        'checker_id',
        'checked_at',
    ];

    protected $casts = [
        'check_result' => ConflictCheckStatus::class,
        'conflicting_parties' => 'array',
        'checked_at' => 'datetime',
    ];

    public function case()
    {
        return $this->belongsTo(CaseModel::class);
    }

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

    public function checker()
    {
        return $this->belongsTo(\App\Models\User::class, 'checker_id');
    }
}
