package com.ecep.contract.converter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

import com.ecep.contract.service.EmployeeService;
import com.ecep.contract.vo.EmployeeVo;

import jakarta.annotation.PostConstruct;

@Lazy
@Component
public class EmployeeStringConverter extends EntityStringConverter<EmployeeVo> {
    @Lazy
    @Autowired
    private EmployeeService service;

    public EmployeeStringConverter() {

    }

    @PostConstruct
    private void init() {
        setInitialized(employee -> service.findById(employee.getId()));
        setSuggestion(service::search);
        setFromString(service::findByName);
    }


}
