<?php

namespace App\Services\Customer;

use App\Entities\Customer\ClientHistoryEntity;
use App\Models\Customer\ClientHistoryModel;

class ClientHistoryService extends CustomerService
{
    private ?ClientService $_clientService = null;
    public function __construct()
    {
        parent::__construct();
        $this->addClassName('ClientHistory');
    }
    public function getModelClass(): ClientHistoryModel
    {
        return new ClientHistoryModel();
    }
    public function getEntityClass(): ClientHistoryEntity
    {
        return new ClientHistoryEntity();
    }
    public function getFormFields(): array
    {
        return [
            "clientinfo_uid",
            "title",
            "description",
        ];
    }
    public function getFilterFields(): array
    {
        return ["clientinfo_uid", 'status'];
    }
    public function getBatchJobFields(): array
    {
        return ['status'];
    }
    public function getIndexFields(): array
    {
        return ['clientinfo_uid', 'title', 'status', 'created_at'];
    }
    //FieldForm관련용
    public function getFormFieldOption(string $field, array $options = []): array
    {
        switch ($field) {
            case 'clientinfo_uid':
                $options = $this->getClientService()->getEntities();
                break;
            default:
                $options = parent::getFormFieldOption($field, $options);
                break;
        }
        return $options;
    }
}
