<?php

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


use App\Classes\General\Abstracts\AbstractValidation;
use App\Classes\Modules\Transactions\DataTransferObjects\WaiveTransactionObject;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\TransactionType;

class WaiveTransactionValidation extends AbstractValidation
{

    /**
     * @param WaiveTransactionObject $object
     * @return array
     */
    protected function data($object): array {
        return [
            'id' => $object->getId(),
            'billNo' => $object->getBillNo(),
            'type' => $object->getType(),
            'status' => $object->getStatus(),
        ];
    }

    /**
     * @return array
     */
    protected function rules(): array {
        return [
            'id' => 'required',
            'type' => ['required', 'numeric', 'in:'.TransactionType::STORAGE_INVOICE], //Only storage invoice (type 16) can be waived
            'status' => ['required', 'numeric', 'in:'.ApprovalStatus::APPROVED], //Approve storage invoice only, paid invoice stricly forbidden
            // 'billNo' => 'required',
        ];
    }

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

}
