<?php

namespace App\Models;

use App\Filters\MortalityFilters;
use Essa\APIToolKit\Filters\Filterable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Mortality extends Model
{
    use HasFactory, SoftDeletes, Filterable;

    protected string $default_filters = MortalityFilters::class;

    protected $table = "mortality_headers";

    protected $fillable = [
        "farm_id",
        "farm_code",
        "farm_name",
        "week_start_date",
        "week_end_date",
        "week_number",
        "year",
        "total_mortality",
        "synced_status",
        "synced_at",
        "synced_id",
        "created_by",
    ];

    public function lines()
    {
        return $this->hasMany(MortalityLines::class, "header_id", "id");
    }
}
