package com.brilliance.isc.swift.objmtconvert.model.busvalidator.mt1xx;
import com.brilliance.isc.swift.objmtconvert.model.AbsMTValidator;
import com.brilliance.isc.swift.objmtconvert.result.MtResult;
import com.brilliance.isc.swift.objmtconvert.util.Language;
import com.prowidesoftware.swift.model.mt.mt1xx.MT196;
import static com.brilliance.isc.swift.objmtconvert.model.busvalidator.ValidatorMethod.isFieldEmpty;

/**
 * MT196校验类，校验规则如下：<br/>
 * 1.79域与相关应答报文必填域的拷贝不能同时出现。不符合时报错C31.<br/>
 * 来源：<a href="https://www2.swift.com/knowledgecentre/publications/uscm_20220722/?topic=mtn95-network-rules.htm">
 *     MT n95 Network Validated Rules</a>
 * @author liusheng
 */
public class MT196Validator extends AbsMTValidator {

    public MT196Validator(String mtstr, MtResult mtResult) {super(mtstr, mtResult);}

    @Override
    public void bussinessValidator() {
       // MtResult mtResult = getMtResult();
        MT196 mt196 = (MT196) getAbstractMT();
        //校验规则1.
        //由于n96报文的相关报文必填域的拷贝目前为空，此时先只判断79域是否为空。
        if(isFieldEmpty(mt196.getField79())) {
            mtResult.addDescription(Language.getLanguage("MTn96_C1", "196"));
        }
      //  return mtResult;
    }
}
