<?php
namespace EasyRestaurantManager\Http\Requests;

class StoreColorRequest extends RequestGuard {
    
    /**
     * Define validation rules
     */
    public function rules() {
        return [
            'name' => 'required|string|max:255',
            'value' => 'nullable|string|max:500',
        ];
    }

    /**
     * Define custom validation messages
     */
    public function messages() {
        return [
            'name.required' => esc_html__('Name is required.', 'easy-restaurant-manager'),
            'name.string' => esc_html__('Name must be a string.', 'easy-restaurant-manager'),
            'name.max' => esc_html__('Name must not exceed 255 characters.', 'easy-restaurant-manager'),
            'value.string' => esc_html__('Description must be a string.', 'easy-restaurant-manager'),
        ];
    }

    /**
     * Define sanitization rules
     */
    public function sanitize() {
        return [
            'name' => 'sanitize_text_field',
            'value' => 'sanitize_text_field',
        ];
    }
}
