<?php

declare(strict_types=1);

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class InpatientRechargeRecord extends Model
{
    use HasFactory;

    /**
     * The attributes that should be hidden for serialization.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'relate_id',
        'relate_order_id',
        'dept_id',
        'dept_name',
        'doctor_id',
        'doctor_name',
        'recharge_amount',
        'extra_info',
    ];

    /**
     * The attributes that should be cast.
     *
     * @var array<string, string>
     */
    protected $casts = [
        'id' => 'integer',
        'relate_id' => 'integer',
        'relate_order_id' => 'integer',
        'recharge_amount' => 'integer',
    ];

    /**
     * Relationships Order.
     */
    public function order(): BelongsTo
    {
        return $this->belongsTo(Order::class, 'relate_order_id');
    }

    /**
     * Relationships Inpatient.
     */
    public function inpatient(): BelongsTo
    {
        return $this->belongsTo(Inpatient::class, 'relate_id');
    }
}