<?php

namespace App\Http\Requests\Design\ModelVersion;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'version_no' => 'nullable|integer|min:1',
            'notes' => 'nullable|string',
            'effective_from' => 'nullable|date',
            'effective_to' => 'nullable|date|after_or_equal:effective_from',
        ];
    }

    public function messages(): array
    {
        return [
            'effective_to.after_or_equal' => __('validation.after_or_equal', ['attribute' => 'effective_to', 'date' => 'effective_from']),
        ];
    }
}
