package com.lingyue.extract.dto.response;

import com.lingyue.extract.entity.Project;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;
import java.util.Map;

/**
 * 项目列表项响应
 * 
 * @author lingyue
 * @since 2026-01-22
 */
@Data
@Schema(description = "项目列表项响应")
public class ProjectListResponse {
    
    @Schema(description = "项目ID")
    private String id;
    
    @Schema(description = "项目名称")
    private String name;
    
    @Schema(description = "项目描述")
    private String description;
    
    @Schema(description = "状态")
    private String status;
    
    @Schema(description = "创建时间")
    private Date createTime;
    
    @Schema(description = "更新时间")
    private Date updateTime;
    
    // ==================== 统计信息 ====================
    
    @Schema(description = "来源文档数量")
    private Integer documentCount;
    
    @Schema(description = "规则数量")
    private Integer ruleCount;
    
    @Schema(description = "提取进度（百分比）")
    private Integer progress;
    
    /**
     * 从实体转换
     */
    public static ProjectListResponse fromEntity(Project project) {
        ProjectListResponse response = new ProjectListResponse();
        response.setId(project.getId());
        response.setName(project.getName());
        response.setDescription(project.getDescription());
        response.setStatus(project.getStatus());
        response.setCreateTime(project.getCreateTime());
        response.setUpdateTime(project.getUpdateTime());
        return response;
    }
}
