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.mt.mt7xx.MT710;

import java.util.Objects;

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

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

    @Override
    public void bussinessValidator() {
        //  MtResult mtResult = getMtResult();
        MT710 mt710 = (MT710)this.getAbstractMT();
        if (!(!Objects.isNull(mt710.getField42C()) && (!Objects.isNull(mt710.getField42A()) || !Objects.isNull(mt710.getField42D())))){
            mtResult.addDescription(Language.getLanguage("MT710_C1","【MT710】"));
        }if (!Objects.isNull(mt710.getField44C()) && !Objects.isNull(mt710.getField44D())){
            mtResult.addDescription(Language.getLanguage("MT710_C3","【MT710】"));
        }if (mt710.getField52A()==null && mt710.getField52D()==null && mt710.getField50B()==null){
            mtResult.addDescription(Language.getLanguage("MT710_C4","【MT710】"));
        }
        if (mt710.getField52A()!=null || mt710.getField52D()!=null){
            if (mt710.getField50B()!=null){
                mtResult.addDescription(Language.getLanguage("MT710_C4","【MT710】"));
            }
        }if (!Objects.isNull(mt710.getField42A()) || !Objects.isNull(mt710.getField42C()) ||
            !Objects.isNull(mt710.getField42D()) || !Objects.isNull(mt710.getField42P())){
               if (!Objects.isNull(mt710.getField42M())){
                   mtResult.addDescription(Language.getLanguage("MT710_C2","【MT710】"));
               }
        }
        if (!Objects.isNull(mt710.getField42A()) || !Objects.isNull(mt710.getField42C()) ||
                !Objects.isNull(mt710.getField42D()) || !Objects.isNull(mt710.getField42M())){
            if (!Objects.isNull(mt710.getField42P())){
                mtResult.addDescription(Language.getLanguage("MT710_C2","【MT710】"));
            }
        }
        // return  mtResult;
    }

}
