<?php

namespace App\Models\Care;

use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class CareRecord extends Model
{
    protected $fillable = [
        'care_profile_id', 'care_plan_id', 'type',
        'items', 'remark', 'images', 'nurse_id', 'recorded_at',
    ];

    protected function casts(): array
    {
        return [
            'type' => 'integer',
            'items' => 'array',
            'images' => 'array',
            'recorded_at' => 'datetime',
        ];
    }

    public function profile(): BelongsTo
    {
        return $this->belongsTo(CareProfile::class, 'care_profile_id');
    }

    public function plan(): BelongsTo
    {
        return $this->belongsTo(CarePlan::class, 'care_plan_id');
    }

    public function nurse(): BelongsTo
    {
        return $this->belongsTo(User::class, 'nurse_id');
    }
}
