<?php

namespace App\Core\Validator\PropertyChannelBookingPaymentSetup;

use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Translation\Translator;

use App\Core\Validator\BaseValidator;


class PropertyChannelBookingPaymentSetupAddValidator extends BaseValidator
{


    public function __construct
    (

        Translator $translator,
        Container $container
    )
    {
        parent::__construct($translator, $container);

    }

    public function rules($params = null)
    {
        return
            [
                "property_id" => 'required|numeric',
                "channel_id" => 'required|numeric',
                "payments" => 'nullable|array',
                "payments.*.payment_type_id" => 'required|numeric',
                "payments.*.is_affected_price" => 'required|boolean',
                "payments.*.action_type" => 'nullable|in:INC,DEC',
                "payments.*.value_type" => 'nullable|in:FIX,PER',
                "payments.*.value" => 'nullable|numeric',
                "payments.*.is_selected" => 'required|boolean',
                "payments.*.cancellation_policy" => 'present|array|nullable',
            ];


    }

    public function messages()
    {
        $thisMessages = [];
        return array_merge(parent::messages() , $thisMessages);
    }


    public function validate(array $params, array $rules = [], array $messages = [], array $customAttributes = [])
    {
        return $this->make($params, $this->rules($params), $this->messages());
    }

}
