<?php

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

use App\Classes\General\Abstracts\AbstractValidation;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;

class CompanyValidation extends AbstractValidation
{
    /**
     * @param CompanyObject $object
     * @return array
     */
    protected function data($object): array
    {
        return [
            'company_name' => $object->getName(),
            'company_reference' => $object->getReference()
        ];
    }

    /**
     * @param string $type
     * @return array
     */
    protected function rules(?string $type = 'POST'): array
    {
        if ($type == 'POST') {
            return [
                'company_name' => 'required',
                'company_reference' => '',
                'type' => ''
            ];
        } elseif ($type == 'PUT') {
            return [
                'type' => 'required'
            ];
        }
    }

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