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.Bank;
import com.ecep.contract.service.BankService;

import jakarta.annotation.PostConstruct;

@Lazy
@Component
public class BankStringConverter extends EntityStringConverter<Bank> {

    @Lazy
    @Autowired
    BankService service;
    public BankStringConverter() {

    }

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