<?php

namespace App\Models;

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

class CattleCalvingEvent extends Model
{
    protected $fillable = [
        'mother_id',
        'calf_id',
        'calving_date',
        'birth_weight_kg',
        'pasture_location',
        'notes',
        'user_id',
    ];

    protected $casts = [
        'calving_date' => 'date',
        'birth_weight_kg' => 'decimal:2',
    ];

    public function mother(): BelongsTo
    {
        return $this->belongsTo(Cattle::class, 'mother_id');
    }

    public function calf(): BelongsTo
    {
        return $this->belongsTo(Cattle::class, 'calf_id');
    }

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