<?php

namespace App\Services\Equipment\Part;

use App\Entities\Equipment\Part\DefenceEntity;
use App\Models\Equipment\Part\DefenceModel;

class DefenceService extends PartService
{
    public function __construct()
    {
        parent::__construct();
        $this->addClassName('Defence');
    }
    public function getModelClass(): DefenceModel
    {
        return new DefenceModel();
    }
    public function getEntityClass(): DefenceEntity
    {
        return new DefenceEntity();
    }
    public function getFormFields(): array
    {
        return [
            "type",
            "ip",
            "accountid",
            "domain",
            "status",
            "description",
        ];
    }
    public function getFilterFields(): array
    {
        return ["type", 'status'];
    }
    public function getBatchJobFields(): array
    {
        return ["type", 'status'];
    }
    public function getIndexFields(): array
    {
        return ['type', 'ip', 'accountid', 'domain', 'status'];
    }
    //List 검색용
    //OrderBy 처리
    public function setOrderBy(mixed $field = null, mixed $value = null): void
    {
        $this->getModel()->orderBy('INET_ATON(ip)', 'ASC');
        parent::setOrderBy($field, $value);
    }
}
