<?php

namespace App\Models;

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

class BatchSplitPlan extends Model
{
    use HasFactory;

    protected $table = 'batch_split_plans';

    protected $fillable = [
        'user_id',
        'batch_id',
        'tank_id',
        'task_project_id',
        'executed_batch_split_session_id',
        'planned_date',
        'reminder_date',
        'followup_date',
        'executed_at',
        'reminder_days_before',
        'objective',
        'notes',
        'status',
    ];

    protected $casts = [
        'planned_date' => 'date:Y-m-d',
        'reminder_date' => 'date:Y-m-d',
        'followup_date' => 'date:Y-m-d',
        'executed_at' => 'datetime',
    ];

    public function taskProject(): BelongsTo
    {
        return $this->belongsTo(TaskProject::class, 'task_project_id');
    }
}
