<?php

namespace App\Http\Requests\Estimate;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'model_set_id' => 'required|exists:categories,id',
            'estimate_name' => 'required|string|max:255',
            'customer_name' => 'nullable|string|max:255',
            'project_name' => 'nullable|string|max:255',
            'parameters' => 'required|array',
            'parameters.*' => 'required',
            'notes' => 'nullable|string|max:2000',
        ];
    }

    public function messages(): array
    {
        return [
            'model_set_id.required' => __('validation.required', ['attribute' => '모델셋']),
            'model_set_id.exists' => __('validation.exists', ['attribute' => '모델셋']),
            'estimate_name.required' => __('validation.required', ['attribute' => '견적명']),
            'customer_name.max' => __('validation.max.string', ['attribute' => '고객명', 'max' => 255]),
            'parameters.required' => __('validation.required', ['attribute' => '견적 파라미터']),
            'parameters.array' => __('validation.array', ['attribute' => '견적 파라미터']),
        ];
    }
}
