<?php

namespace App\Models\Care;

use App\Models\Crm\Customer;
use App\Models\Room\Reservation;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

class CareProfile extends Model
{
    protected $fillable = [
        'customer_id', 'reservation_id', 'type', 'baby_name', 'baby_gender',
        'baby_birthday', 'birth_weight', 'birth_method',
        'allergies', 'medical_history', 'risk_level', 'assessment',
    ];

    protected function casts(): array
    {
        return [
            'type' => 'integer',
            'baby_gender' => 'integer',
            'baby_birthday' => 'datetime',
            'birth_weight' => 'decimal:2',
            'birth_method' => 'integer',
            'risk_level' => 'integer',
            'assessment' => 'array',
        ];
    }

    public function customer(): BelongsTo
    {
        return $this->belongsTo(Customer::class);
    }

    public function reservation(): BelongsTo
    {
        return $this->belongsTo(Reservation::class);
    }

    public function plans(): HasMany
    {
        return $this->hasMany(CarePlan::class);
    }

    public function records(): HasMany
    {
        return $this->hasMany(CareRecord::class);
    }

    public function exceptions(): HasMany
    {
        return $this->hasMany(CareException::class);
    }

    public function healthMetrics(): HasMany
    {
        return $this->hasMany(HealthMetric::class);
    }
}
