package com.brilliance.isc.swift.objmtconvert.model.busvalidator.mt7xx;


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.field.*;
import com.prowidesoftware.swift.model.mt.mt7xx.MT734;
import java.util.Objects;

/**
 * MT750
 * @author wanggang
 * @Date 2023-3-3
 */
public class MT734Validator extends AbsMTValidator {

    public MT734Validator(String mtStr, MtResult mtResult)
    {
        super(mtStr,mtResult);
    }

    @Override
    public void bussinessValidator() {
        // MtResult mtResult = getMtResult();
        MT734 mt734= (MT734)this.getAbstractMT();

        if (!Objects.isNull(mt734.getField73A())){
            if (Objects.isNull(mt734.getField33A()) && Objects.isNull(mt734.getField33B())){
                mtResult.addDescription(Language.getLanguage("MT734_C1","【MT734】"));
            }
        }
        Field33B field33B = mt734.getField33B();
        Field33A field33A = mt734.getField33A();
        String field33Currency = "";
        if(field33B!=null){
            field33Currency = field33B.getCurrency();
        }
        if(field33A!=null){
            field33Currency = field33A.getCurrency();
        }
        Field32A field32A = mt734.getField32A();
        if(field32A!=null){
            String field32Currency = field32A.getCurrency();
            if(!field33Currency.equals(field32Currency)){
                mtResult.addDescription(Language.getLanguage("MT734_C2","【MT734】"));
            }
        }
        //  return  mtResult;
    }

}
