package com.eactive.testmaster.client.entity;

import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "API_LAYOUT")
public class ApiLayout {

    @Id
    private String id;

    @ManyToOne
    @JoinColumn(name = "API_REQUEST_INFO_ID")
    private ApiRequestInfo apiRequestInfo;

    private String loutName;

    private String loutPtrnName;

    private String loutDesc;

    private String eaiBzwkDstCd;

    private String uApplName;

    private String sysIntFacName;

    private String author;

    private String eaiSevRdStCd;

    private String modfMgtStusDstCd;

    private String useYn;

    private String verInfo;

    @OneToMany(mappedBy = "apiLayout", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
    private List<ApiLayoutItem> layoutItems = new ArrayList<>();

    @Lob
    private String computedLayoutItemRoot;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public ApiRequestInfo getApiRequestInfo() {
        return apiRequestInfo;
    }

    public void setApiRequestInfo(ApiRequestInfo apiRequestInfo) {
        this.apiRequestInfo = apiRequestInfo;
    }

    public String getLoutName() {
        return loutName;
    }

    public void setLoutName(String loutName) {
        this.loutName = loutName;
    }

    public String getLoutPtrnName() {
        return loutPtrnName;
    }

    public void setLoutPtrnName(String loutPtrnName) {
        this.loutPtrnName = loutPtrnName;
    }

    public String getLoutDesc() {
        return loutDesc;
    }

    public void setLoutDesc(String loutDesc) {
        this.loutDesc = loutDesc;
    }

    public String getEaiBzwkDstCd() {
        return eaiBzwkDstCd;
    }

    public void setEaiBzwkDstCd(String eaiBzwkDstCd) {
        this.eaiBzwkDstCd = eaiBzwkDstCd;
    }

    public String getUApplName() {
        return uApplName;
    }

    public void setUApplName(String uApplName) {
        this.uApplName = uApplName;
    }

    public String getSysIntFacName() {
        return sysIntFacName;
    }

    public void setSysIntFacName(String sysIntFacName) {
        this.sysIntFacName = sysIntFacName;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getEaiSevRdStCd() {
        return eaiSevRdStCd;
    }

    public void setEaiSevRdStCd(String eaiSevRdStCd) {
        this.eaiSevRdStCd = eaiSevRdStCd;
    }

    public String getModfMgtStusDstCd() {
        return modfMgtStusDstCd;
    }

    public void setModfMgtStusDstCd(String modfMgtStusDstCd) {
        this.modfMgtStusDstCd = modfMgtStusDstCd;
    }

    public String getUseYn() {
        return useYn;
    }

    public void setUseYn(String useYn) {
        this.useYn = useYn;
    }

    public String getVerInfo() {
        return verInfo;
    }

    public void setVerInfo(String verInfo) {
        this.verInfo = verInfo;
    }

    public List<ApiLayoutItem> getLayoutItems() {
        return layoutItems;
    }

    public void setLayoutItems(List<ApiLayoutItem> layoutItems) {
        this.layoutItems = layoutItems;
    }

    public void addApiLayoutItem(ApiLayoutItem item) {
        item.setApiLayout(this);
        this.layoutItems.add(item);
    }

    public String getComputedLayoutItemRoot() {
        return computedLayoutItemRoot;
    }

    public void setComputedLayoutItemRoot(String computedLayoutItemRoot) {
        this.computedLayoutItemRoot = computedLayoutItemRoot;
    }
}
