package com.microservices.pms.product.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.microservices.common.core.utils.bean.BeanUtils;
import com.microservices.common.core.web.domain.BaseEntity;
import com.microservices.pms.product.domain.vo.PmsProductModuleDataVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
 * 产品模块对象 pms_product_module
 *
 * @author otto
 * @date 2023-10-10
 */
@Data
@ApiModel("产品模块对象")
public class PmsProductModule extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 产品模块ID */
    private Long id;

    /** 产品模块名 */
    @ApiModelProperty(value = "模块名")
    private String moduleName;

    /**
     * 关联产品标识
     */
    @ApiModelProperty(value = "关联产品标识")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private String pmsProductIdentifier;

    /** 父模块ID */
    @ApiModelProperty(value = "父模块ID")
    private Long parentId;

    /** 排序 */
    @ApiModelProperty(value = "排序")
    private Integer sort;

    /** 需求数量 */
    @ApiModelProperty(value = "需求数量")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Integer requirementCount;

    /**
     * 节点数据数量
     */
    @ApiModelProperty(value = "节点数据数量")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Integer nodeDataCount;

    /**
     * 测试用例数量 TODO-pms:计算测试用例数量
     */
    @ApiModelProperty(value = "测试用例数量")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Integer testCaseCount;

    @ApiModelProperty(value = "测试单执行用例数量")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Integer testsheetCasesCount;

    /** 删除标志（0代表存在 2代表删除） */
    private String delFlag;

    /**
     * 模块类型（1产品模块 2测试用例模块）
     */
    @ApiModelProperty(value = "模块类型（1产品模块 2测试用例模块）")
    private Integer type;

    /**
     * 关联项目ID
     */
    @ApiModelProperty(value = "关联项目ID")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Long pmsProjectId;
    /**
     * 子模块
     */
    @ApiModelProperty("子模块")
    private List<PmsProductModule> children = new ArrayList<>();

    public PmsProductModuleDataVo toPmsProductModuleDataVo(){
        PmsProductModuleDataVo target = new PmsProductModuleDataVo();
        BeanUtils.copyProperties(this, target);
        return target;
    }
}
