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

import com.brilliance.isc.swift.objmtconvert.model.AbsMTCreator;
import com.brilliance.isc.swift.objmtconvert.model.AbsTagCreate;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.MT416Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.mt4XXAbsCreator.MT416AbsCreator;

import java.util.List;

public class TagCycleCreator extends AbsTagCreate {

     private MT416Creator mt416Creator;

    public TagCycleCreator(AbsMTCreator absMTCreator) {
        super(absMTCreator);
        this.mt416Creator= (MT416Creator) absMTCreator;
    }

    public  void creator() {
        List<MT416AbsCreator> tagList = mt416Creator.getMt416SequenceBCreatorList();
        if(tagList != null && tagList.size() > 0){
            for (MT416AbsCreator abs416 : tagList) {
                mt416Creator.set("21A", abs416.getRelatedSeqRef());
                mt416Creator.set("23E", abs416.getAdviceType());
                mt416Creator.set("21C", abs416.getPrincipalRef());
                mt416Creator.set("32a" + abs416.getFaceAmt().getTagResult().getTagEnd(), abs416.getFaceAmt().getTagResult().getValue());
                mt416Creator.set("50D" + abs416.getPrincipal().getTagResult().getTagEnd(), abs416.getPrincipal().getTagResult().getValue());
                mt416Creator.set("59" + abs416.getDrawee().getTagResult().getTagEnd(), abs416.getDrawee().getTagResult().getValue());
                mt416Creator.set("71F", abs416.getSenderCharges());
                mt416Creator.set("77A", abs416.getReason());
            }
        }
    }
}
