<?php

namespace App\Classes\Modules\Currencies\Standards\Validators;


use App\Classes\General\Abstracts\AbstractValidation;
use App\Classes\Modules\Currencies\DataTransferObjects\RateObject;

class RateValidation extends AbstractValidation
{
    /**
     * @param RateObject $object
     * @return array
     */
    protected function data($object): array {

        $data = [
            'currency_id'=> $object->getCurrencyId(),
            'selling' => $object->getSelling(),
            'payment_method_type' => $object->getPaymentMethodType(),
        ];

        return $data;
    }

    /**
     * @param null|string $type
     * @return array
     */
    protected function rules(?string $type = 'POST'): array {
        return [
            'currency_id' => $type == 'POST' ? 'required' : '',
            'selling' => 'required',
            'payment_method_type' => 'required',
        ];
    }

    /**
     * @return array
     */
    protected function messages(): array {
        return [];
    }

}