<?php

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

use App\Classes\General\Abstracts\AbstractValidation;
use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject;

class SegmentValidation extends AbstractValidation
{
    /**
     * @param SegmentObject $object
     * @return array
     */
    protected function data($object): array
    {
        return [
            'name' => $object->getName(),
            'company_module_id' => $object->getCompanyModuleId()
        ];
    }

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

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