<?php

namespace App\Http\Requests\BatchSplitSessions;

use Illuminate\Foundation\Http\FormRequest;

class StoreBatchSplitSessionRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'source_batch_id' => ['required', 'integer', 'min:1'],
            'date' => ['required', 'date'],
            'fish_count_counted' => ['nullable', 'integer', 'min:0'],
            'fish_missing' => ['nullable', 'integer', 'min:0'],
            'avg_weight_reference_g' => ['nullable', 'numeric', 'min:0'],
            'notes' => ['nullable', 'string'],
            'adjustment_reason' => ['nullable', 'string', 'max:1000'],
            'lines' => ['required', 'array', 'min:1'],
            'lines.*.destination_batch_id' => ['required', 'integer', 'min:1'],
            'lines.*.fish_moved' => ['required', 'integer', 'min:1'],
            'lines.*.avg_weight_moved_g' => ['required', 'numeric', 'min:0.01'],
            'lines.*.grading_label' => ['nullable', 'string', 'max:120'],
            'lines.*.notes' => ['nullable', 'string'],
        ];
    }
}
