<?php

namespace Kylin\LawCase\Listeners;

use Kylin\LawCase\Events\CaseCreated;
use Kylin\LawCase\Models\CaseMilestone;

/**
 * 记录案件创建监听器
 *
 * 监听案件创建事件，记录创建里程碑。
 */
class RecordCaseCreation
{
    public function handle(CaseCreated $event): void
    {
        CaseMilestone::create([
            'case_id' => $event->case->id,
            'milestone_type' => 'created',
            'milestone_date' => now()->toDateString(),
            'description' => '案件创建',
        ]);
    }
}
