<?php
namespace EasyRestaurantManager\Http\Requests;

class StoreTableRequest extends RequestGuard {
    
    /**
     * Define validation rules
     */
    public function rules() {
        return [
            'table_number' => 'required|string',
            'capacity' => 'required|integer',
            'branch_id' => 'required|integer',
            'status' => 'required|string', 
        ];
    }

    /**
     * Define custom validation messages
     */
    public function messages() {
        return [
            'table_number.required' => esc_html__('Table number is required.', 'easy-restaurant-manager'),
            'capacity.in' => "Capacity type must be 'fixed' or 'percentage'.",
            'capacity.required' => "Capacity value is required.",
            'capacity.min' => "Capacity value cannot be negative.",
            'status.required' => "Table status is required.",
            'branch_id.required' => esc_html__('Branch id is required.', 'easy-restaurant-manager'),
            'branch_id.integer' => esc_html__('Branch id must be an integer.', 'easy-restaurant-manager'),
        ];
    }

    /**
     * Define sanitization rules
     */
    public function sanitize() {
        return [
            'table_number ' => 'sanitize_text_field',
            'capacity' => 'sanitize_text_field',
            'status' => 'sanitize_text_field',
            'branch_id' => 'sanitize_text_field'
        ];
    }
}
