<?php

namespace App\Core\Validator\PropertyChannelSetup;

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

use App\Core\Validator\BaseValidator;

use Exception;

class PropertyChannelSetupUpdateValidator extends BaseValidator
{



    public function __construct
    (

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

    }

    public function rules($params = null)
    {
        return
            [
                'property_id' => 'required',
                'channel_id' => 'required',
                'currency_code' => 'nullable|string|required_without:connected_channel_id',
                'booking_type_id' => 'nullable|numeric|required_without:connected_channel_id',
                'availability_type_id' => 'nullable|numeric|required_without:connected_channel_id',
                'room_pricing_type_id' => 'nullable|numeric|required_without:connected_channel_id',
                'connected_channel_id' => 'nullable|numeric|required_without:currency_code',
                'connected_channel_action' => 'nullable|string|required_with:connected_channel_id'
            ];

    }

    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());
    }

}
