<?php

namespace App\Services\Equipment;

use App\Entities\Equipment\CSEntity;
use App\Models\Equipment\CSModel;

class CSService extends EquipmentService
{
    public function __construct()
    {
        parent::__construct(new CSModel());
        $this->addClassName('CS');
    }
    public function getFormFields(): array
    {
        return [
            'fields' => [
                "serverinfo_uid",
                "type",
                "ip",
                "accountid",
                "domain",
                "price",
                "amount",
                "status",
            ],
            'filters' => [
                "clientinfo_uid",
                'serverinfo_uid',
                'type',
                'status'
            ],
        ];
    }
    public function getIndexFields(): array
    {
        return [
            'fields' => [
                "clientinfo_uid",
                'serverinfo_uid',
                'type',
                'ip',
                'accountid',
                'domain',
                'price',
                "amount",
                'status'
            ],
            'filters' => [
                "clientinfo_uid",
                'serverinfo_uid',
                'type',
                'status'
            ],
        ];
    }
    public function getBatchjobFields(): array
    {
        return ['type', 'status'];
    }
    //기본 기능부분
    //List 검색용
    //OrderBy 처리
    public function setOrderBy(mixed $field = null, mixed $value = null): void
    {
        $this->getModel()->orderBy('INET_ATON(ip)', 'ASC');
        parent::setOrderBy($field, $value);
    }
}
