package com.dora.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 工作流数据获取DTO
 */
@Data
@Schema(description = "工作流数据获取")
public class WorkflowDataDto {

    private WorkflowDataDto() {
        // Private constructor to hide the implicit public one
    }

    @Data
    @Schema(description = "获取工作流数据包下载地址响应")
    public static class DataFileResponse {
        @Schema(description = "工作流ID")
        private Long workflowId;

        @Schema(description = "工作流名称")
        private String workflowName;

        @Schema(description = "数据包下载地址")
        private String dataFileUrl;

        @Schema(description = "文件大小（字节）")
        private Long fileSize;

        @Schema(description = "文件格式")
        private String fileFormat;

        @Schema(description = "下载有效期（秒）")
        private Long validityPeriod;

        @Schema(description = "访问统计信息")
        private AccessStatInfo accessStat;

        @Schema(description = "用户权限信息")
        private UserPermissionInfo userPermission;
    }

    @Data
    @Schema(description = "获取工作流JSON数据响应")
    public static class JsonDataResponse {
        @Schema(description = "工作流ID")
        private Long workflowId;

        @Schema(description = "工作流名称")
        private String workflowName;

        @Schema(description = "JSON数据")
        private String jsonData;

        @Schema(description = "数据大小（字节）")
        private Long dataSize;

        @Schema(description = "数据版本")
        private String dataVersion;

        @Schema(description = "访问统计信息")
        private AccessStatInfo accessStat;

        @Schema(description = "用户权限信息")
        private UserPermissionInfo userPermission;
    }

    @Data
    @Schema(description = "访问统计信息")
    public static class AccessStatInfo {
        @Schema(description = "总复制次数（包含本次）")
        private Integer totalCopyCount;

        @Schema(description = "本次访问时间")
        private LocalDateTime accessTime;

        @Schema(description = "访问类型（data_file/json_data）")
        private String accessType;
    }

    @Data
    @Schema(description = "用户权限信息")
    public static class UserPermissionInfo {
        @Schema(description = "用户角色")
        private Integer userRole;

        @Schema(description = "用户角色名称")
        private String userRoleName;

        @Schema(description = "工作流要求的最低级别")
        private Integer requiredLevel;

        @Schema(description = "是否有访问权限")
        private Boolean hasPermission;

        @Schema(description = "权限检查时间")
        private LocalDateTime checkTime;
    }
}