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.ProductUsageService;
import com.ecep.contract.vo.ProductUsageVo;

import jakarta.annotation.PostConstruct;

@Lazy
@Component
public class ProductUsageStringConverter extends EntityStringConverter<ProductUsageVo> {
    @Lazy
    @Autowired
    private ProductUsageService service;

    public ProductUsageStringConverter() {

    }

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


}