<?php

namespace App\Core\Validator\PropertyCancellationPolicy;

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

use App\Core\Validator\BaseValidator;

use Exception;

class PropertyCancellationPolicyAddValidator extends BaseValidator
{


    private $setupType ;
    private $valueType ;

    public function __construct
    (


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

    }

    public function rules($params = null)
    {
        return
            [
                'property_id' => 'required|numeric',
                'name' => 'nullable',
                'before_arrival' => 'required|numeric',
                'is_nonrefundable' => 'required|boolean',
                'is_free_cancellation' => 'required|boolean',
                'type' => 'nullable|in:PER,FIX,NGT',
                'value' => 'nullable|numeric',
                'affects_price' => 'required|boolean',
                'affects_price_action_type' => 'nullable|in:INC,DEC',
                'affects_price_type' => 'nullable|in:PER,FIX',
                'affects_price_value' => 'nullable|numeric',
                'is_date_range' => 'required|boolean',
                'start_date' => 'required_without:is_date_range|date',
                'finish_date' => 'required_without:is_date_range|date|after:start_date',
            ];


    }

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

}
