package com.brilliance.isc.swift.objmtconvert.model.mt4xx.tag.tag422;

import com.brilliance.isc.swift.objmtconvert.model.AbsMTCreator;
import com.brilliance.isc.swift.objmtconvert.model.AbsTagCreate;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.MT422Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.mt4XXAbsCreator.MT422AbsCreator;

import java.util.List;

public class TagCycleCreator extends AbsTagCreate {

     private MT422Creator mt422Creator;

    public TagCycleCreator(AbsMTCreator absMTCreator)
    {
        super(absMTCreator);
        this.mt422Creator= (MT422Creator) absMTCreator;
    }


    public  void creator()
    {
        List<MT422AbsCreator> tagList = mt422Creator.getMt422AbsCreators();
        if(tagList!=null&&tagList.size()>0){
            for (MT422AbsCreator abs422:tagList) {
                mt422Creator.set("20",abs422.getSendingBankTRN());
                mt422Creator.set("21",abs422.getRelatedReference());
                mt422Creator.set("32"+abs422.getAmountOfCollection().getTagResult().getTagEnd(),abs422.getAmountOfCollection().getTagResult().getValue());
            }
        }
    }
}
