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.ProductTypeService;
import com.ecep.contract.vo.ProductTypeVo;

import jakarta.annotation.PostConstruct;

@Lazy
@Component
public class ProductTypeStringConverter extends EntityStringConverter<ProductTypeVo> {
    @Lazy
    @Autowired
    private ProductTypeService service;

    public ProductTypeStringConverter() {

    }

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


}