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.MT195;
import static com.brilliance.isc.swift.objmtconvert.model.busvalidator.ValidatorMethod.isFieldEmpty;

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

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

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