package com.its.op.dto.its.link;

import com.its.op.entity.its.link.TbLinkParaClctSyst;
import com.its.op.entity.its.link.TbLinkParaDetl;
import com.its.op.entity.its.link.TbLinkParaStup;
import lombok.*;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class LinkPrcsParaDto implements Serializable {

    @Getter
    public static class LinkPrcsParaInfo {

        private LinkParaStupDto.LinkParaStupInfo stup = null;
        private LinkParaDetlDto.LinkParaDetlInfo detl = null;
        private List<LinkParaClctSystDto.LinkParaClctSystInfo> systList = new ArrayList<>();

        public LinkPrcsParaInfo(
                TbLinkParaStup stup,
                TbLinkParaDetl detl,
                List<TbLinkParaClctSyst> systList) {

            if (stup != null) {
                this.stup = new LinkParaStupDto.LinkParaStupInfo(stup);
            }
            if (detl != null) {
                this.detl = new LinkParaDetlDto.LinkParaDetlInfo(detl);
            }
            for (TbLinkParaClctSyst syst : systList) {
                this.systList.add(new LinkParaClctSystDto.LinkParaClctSystInfo(syst));
            }
        }
    }

    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class LinkPrcsParaUpdateReq {

        private LinkParaStupDto.LinkParaStupUpdateReq stup;
        private LinkParaDetlDto.LinkParaDetlUpdateReq detl;
        private List<LinkParaClctSystDto.LinkParaClctSystUpdateReq> systList;

        @Builder
        public LinkPrcsParaUpdateReq(
                LinkParaStupDto.LinkParaStupUpdateReq stup,
                LinkParaDetlDto.LinkParaDetlUpdateReq detl,
                List<LinkParaClctSystDto.LinkParaClctSystUpdateReq> systList) {
            this.stup = stup;
            this.detl = detl;

            // FOR KISA Secure Coding pass
            //this.systList = systList;
            List<LinkParaClctSystDto.LinkParaClctSystUpdateReq> temp = systList;
            this.systList = temp;
        }
    }
}
