<?php

namespace App\Http\Requests\Employee;

use Illuminate\Foundation\Http\FormRequest;

class RuleRequest 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 [
            'rule_code' => ['required', 'string', 'max:255'],
            'statement_id' => ['required'],
            'personality_id' => ['required'],
            'weight_id' => ['required'],
        ];
    }

    public function messages(): array
    {
        return [
            'rule_code.required' => 'Kode rule harus diisi.',
            'rule_code.string' => 'Kode rule harus berupa teks.',
            'rule_code.max' => 'Kode rule tidak boleh lebih dari 255 karakter.',
            'statement_id.required' => 'Statemen/pernyataan harus dipilih.',
            'personality_id.required' => 'Tipe kepribadian harus dipilih.',
            'weight_id.required' => 'Bobot harus dipilih.',
        ];
    }
}
