package com.ecep.contract.ds.project.service;

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

import com.ecep.contract.ds.converter.EntityStringConverter;
import com.ecep.contract.model.Project;

import jakarta.annotation.PostConstruct;

@Lazy
@Component
public class ProjectStringConverter extends EntityStringConverter<Project> {

    @Lazy
    @Autowired
    private ProjectService service;


    public ProjectStringConverter() {
    }

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


}
