<?php

namespace App\Models;

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

class FeedingLog extends Model
{
    protected $fillable = [
        'pond_id', 'cycle_id', 'feed_date', 'feed_time', 'feed_brand',
        'feed_type', 'quantity_kg', 'estimated_fish_count', 'feeding_response',
        'notes', 'logged_by',
    ];

    protected function casts(): array
    {
        return [
            'feed_date' => 'date',
            'quantity_kg' => 'decimal:2',
        ];
    }

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

    public function cycle(): BelongsTo
    {
        return $this->belongsTo(ProductionCycle::class, 'cycle_id');
    }

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