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


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.Tag;

import java.util.List;


public class MT935Validator extends AbsMTValidator {

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

    @Override
    public void bussinessValidator() {
        // MtResult mtResult=getMtResult();
        List<Tag> tags = this.getAbstractMT().getSwiftMessage().getBlock4().getTags();
        int count = 0;
        int count2 = 0;
        for (Tag tag : tags) {
            if(tag.getName().contains("30")){
                count++;
            }
            if(tag.getName().contains("23")||tag.getName().contains("25")){
                count2++;
            }
        }
        if(count2 < count){
            mtResult.addDescription(Language.getLanguage("MT935_C1","【MT935】"));
        }
        if(count <1||count>10){
            mtResult.addDescription(Language.getLanguage("MT935_C2","【MT935】"));
        }
        //     return  mtResult;
    }
}
