<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ContactRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            'company_name'     => ['required', 'string', 'max:255'],
            'full_name'        => ['required', 'string', 'max:255'],
            'email'            => ['required', 'email', 'max:255'],
            'development_type' => ['nullable', 'string', 'in:new_system,system_update,ai_ml,mobile_app,other'],
            'message'          => ['nullable', 'string', 'max:2000'],
        ];
    }

    /**
     * Get custom messages for validator errors.
     */
    public function messages(): array
    {
        return [
            'company_name.required' => '会社名は必須です。',
            'company_name.max'      => '会社名は255文字以内で入力してください。',
            'full_name.required'    => 'お名前は必須です。',
            'full_name.max'         => 'お名前は255文字以内で入力してください。',
            'email.required'        => 'メールアドレスは必須です。',
            'email.email'           => '正しいメールアドレスを入力してください。',
            'email.max'             => 'メールアドレスは255文字以内で入力してください。',
            'development_type.in'   => '有効な開発内容を選択してください。',
            'message.max'           => 'ご相談内容は2000文字以内で入力してください。',
        ];
    }
}
