package com.dora.dto;

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

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 工作流详情DTO
 */
@Data
@Schema(description = "工作流详情")
public class WorkflowDetailDto {

    @Schema(description = "工作流基本信息")
    private WorkflowInfo workflow;

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

    @Data
    @Schema(description = "工作流基本信息")
    public static class WorkflowInfo {
        @Schema(description = "工作流ID")
        private Long id;

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

        @Schema(description = "工作流描述")
        private String description;

        @Schema(description = "封面图URL")
        private String coverUrl;

        @Schema(description = "详情图集（JSON格式存储多张图片URL）")
        private String detailGallery;

        @Schema(description = "预览视频ID（阿里云VOD视频ID）")
        private String vodVideoId;

        @Schema(description = "价格")
        private BigDecimal price;

        @Schema(description = "点赞数量")
        private Integer likeCount;

        @Schema(description = "复制次数")
        private Integer copyCount;

        @Schema(description = "查看完整数据所需最低角色（0-游客/1-普通/2-VIP/3-SVIP）")
        private Integer fullAccessRole;

        @Schema(description = "复制所需最低角色（0-游客/1-普通/2-VIP/3-SVIP）")
        private Integer copyAccessRole;

        @Schema(description = "分类")
        private String category;

        @Schema(description = "评分(1-5)")
        private Integer rating;

        @Schema(description = "是否免费")
        private Boolean isFree;

        @Schema(description = "是否公开")
        private Boolean isPublic;

        @Schema(description = "数据类型", allowableValues = {"file_only", "json_only", "both", "none"})
        private String dataType;

        @Schema(description = "是否有数据包文件")
        private Boolean hasDataFile;

        @Schema(description = "是否有JSON数据")
        private Boolean hasJsonData;

        @Schema(description = "角色级别名称")
        private String fullAccessRoleName;

        @Schema(description = "复制角色级别名称")
        private String copyAccessRoleName;

        @Schema(description = "创建时间")
        private LocalDateTime createTime;

        @Schema(description = "更新时间")
        private LocalDateTime updateTime;

        @Schema(description = "创建者信息")
        private CreatorInfo creator;
    }

    @Data
    @Schema(description = "创建者信息")
    public static class CreatorInfo {
        @Schema(description = "创建者ID")
        private String id;

        @Schema(description = "创建者用户名")
        private String username;

        @Schema(description = "创建者头像URL")
        private String avatarUrl;
    }

    @Data
    @Schema(description = "用户权限信息")
    public static class UserPermission {
        @Schema(description = "用户角色（0-游客/1-普通/2-VIP/3-SVIP）")
        private Integer userRole;

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

        @Schema(description = "查看完整数据所需的最低级别")
        private Integer requiredFullAccessLevel;

        @Schema(description = "查看完整数据所需的级别名称")
        private String requiredFullAccessLevelName;

        @Schema(description = "复制所需的最低级别")
        private Integer requiredCopyLevel;

        @Schema(description = "复制所需的级别名称")
        private String requiredCopyLevelName;

        @Schema(description = "是否有查看完整数据权限")
        private Boolean hasFullAccess;

        @Schema(description = "是否有复制权限")
        private Boolean hasCopyAccess;

        @Schema(description = "无权限访问的原因")
        private String accessDeniedReason;

        @Schema(description = "会员到期时间")
        private LocalDateTime membershipExpiresAt;
    }
}