<?php

namespace Kylin\LawCase\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 发票模型
 *
 * 管理案件费用发票，包括发票编号、状态、金额等。
 *
 * @property string $invoice_no     发票编号
 * @property string $invoice_status 发票状态
 * @property float  $amount         金额
 */
class Invoice extends Model
{
    protected $table = 'kylin_law_invoices';

    protected $fillable = [
        'fee_id',
        'invoice_no',
        'invoice_status',
        'amount',
        'issue_date',
        'description',
    ];

    protected $casts = [
        'amount' => 'decimal:2',
        'issue_date' => 'date',
    ];

    public function fee()
    {
        return $this->belongsTo(Fee::class);
    }
}
