package com.brilliance.isc.common.transaction.newcheck.lgbdet;

import com.brilliance.isc.common.lgbdet.vo.LgbdetVo;
import com.brilliance.isc.common.transaction.newcheck.AbstractModuleValidator;
import com.brilliance.isc.common.transaction.newcheck.Warning;
import com.brilliance.isc.common.transaction.newcheck.WarningResult;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class LgbdetValidator extends AbstractModuleValidator<LgbdetVo> {

    @Override
    @PostConstruct
    public void register() {
        super.register();
    }

    @Warning(path = "Lgbdet.errorMsg")
    public WarningResult warningErrorMsg(LgbdetVo lgbdetVo) {
        if (StringUtils.isNotEmpty(lgbdetVo.getErrsta())
                && StringUtils.isNotEmpty(lgbdetVo.getErrmsg())) {
            return WarningResult.build("SUBERRORMSG", lgbdetVo.getErrmsg());
        }
        return WarningResult.buildEmpty("SUBERRORMSG");
    }
}
