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.model.Employee;
import com.ecep.contract.service.EmployeeService;

import jakarta.annotation.PostConstruct;

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

    public EmployeeStringConverter() {

    }

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


}
