package com.bocloud.ims.entity.resource;


import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.IgnoreAll;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
import com.bocloud.entity.bean.GenericEntity;
import com.bocloud.entity.meta.PKStrategy;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Table("sangfor_server_group")
@Data
public class SangforServerGroup extends GenericEntity {
    @PK(value = PKStrategy.AUTO)
    private Long id;
    @Column("uuid")
    private String uuid;
    @Column("type")
    private String type;
    @Column("path")
    private String path;
    @Column("owner")
    private String owner;
    @Column("vendor_id")
    private Long vendorId; // 云供应商Id

    @Column("cloud_type")
    private String cloudType;
    @Column("parent_id")
    private String parentId;
    @Column("platform_type")
    private String platformType;
    @Column("project_id")
    private String projectId;
    @Column("group_type")
    private String groupType;
    @Column("az_id")
    private String azId;
    @IgnoreAll
    private List<Object> serverIds;
    @IgnoreAll
    private String azName;
    @IgnoreAll
    private String projectName;
    @IgnoreAll
    private List<SangforServerGroup> children;

    public SangforServerGroup(Long id, String uuid, String parentId, String name, Long creatorId,
                              String azName, String azId, String projectName, String projectId) {
        this.id = id;
        this.uuid = uuid;
        this.parentId = parentId;
        this.azName = azName;
        this.azId = azId;
        this.projectName = projectName;
        this.projectId = projectId;
        this.setName(name);
        this.setCreatorId(creatorId);
        this.children = new ArrayList<>();
    }

    public SangforServerGroup(Long id, String uuid, String parentId, String name, Long creatorId,
                              String azName, String azId, String projectName, String projectId, Date gmtCreate) {
        this.id = id;
        this.uuid = uuid;
        this.parentId = parentId;
        this.azName = azName;
        this.azId = azId;
        this.projectName = projectName;
        this.projectId = projectId;
        this.setName(name);
        this.setCreatorId(creatorId);
        this.children = new ArrayList<>();
        this.setGmtCreate(gmtCreate);
    }

    public SangforServerGroup() {
    }
}
