package com.dora.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 广场作品投诉 DTO
 * 
 * @author 1818AI
 * @since 2025-11-14
 */
public class PlazaWorkReportDto {

    /**
     * 提交投诉请求
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "提交投诉请求")
    public static class SubmitReportRequest {
        
        @NotBlank(message = "作品编号不能为空")
        @Schema(description = "被投诉的作品编号", example = "WORK-20251026-001", required = true)
        private String workNo;
        
        @NotBlank(message = "投诉类型不能为空")
        @Schema(description = "投诉类型：political-政治敏感，pornographic-色情低俗，violent-暴力血腥，dangerous-危险行为，uncomfortable-引人不适，other-其他", 
                example = "pornographic", required = true)
        private String reportType;
        
        @Schema(description = "投诉原因描述（可选）", example = "该作品包含不当内容")
        private String reportReason;
    }

    /**
     * 投诉响应
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "投诉响应")
    public static class ReportResponse {
        
        @Schema(description = "投诉编号", example = "REPORT-20251114-001")
        private String reportNo;
        
        @Schema(description = "作品编号", example = "WORK-20251026-001")
        private String workNo;
        
        @Schema(description = "投诉类型", example = "pornographic")
        private String reportType;
        
        @Schema(description = "投诉类型名称", example = "色情低俗")
        private String reportTypeName;
        
        @Schema(description = "投诉原因", example = "该作品包含不当内容")
        private String reportReason;
        
        @Schema(description = "投诉状态", example = "pending")
        private String reportStatus;
        
        @Schema(description = "投诉状态名称", example = "待审核")
        private String reportStatusName;
        
        @Schema(description = "投诉时间")
        private LocalDateTime createTime;
    }

    /**
     * 投诉列表响应
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "投诉列表响应")
    public static class ReportListResponse {
        
        @Schema(description = "投诉列表")
        private List<ReportResponse> records;
        
        @Schema(description = "总记录数")
        private Long total;
        
        @Schema(description = "当前页码")
        private Integer page;
        
        @Schema(description = "每页数量")
        private Integer size;
        
        @Schema(description = "总页数")
        private Integer totalPages;
    }

    /**
     * 管理员审核投诉请求
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "管理员审核投诉请求")
    public static class AuditReportRequest {
        
        @NotBlank(message = "投诉编号不能为空")
        @JsonProperty("reportNo")
        @Schema(description = "投诉编号", example = "REPORT-20251114-001", required = true)
        private String reportNo;
        
        @NotBlank(message = "审核结果不能为空")
        @JsonProperty("auditStatus")
        @Schema(description = "审核结果：approved-投诉成立，rejected-投诉不成立", 
                example = "approved", required = true)
        private String auditStatus;
        
        @JsonProperty("auditRemark")
        @Schema(description = "审核备注（处理说明）", example = "经审核，该作品确实存在违规内容，已下架处理")
        private String auditRemark;
    }

    /**
     * 管理员投诉列表查询请求
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "管理员投诉列表查询请求")
    public static class AdminReportQueryRequest {
        
        @Schema(description = "页码", example = "1")
        private Integer page = 1;
        
        @Schema(description = "每页数量", example = "20")
        private Integer size = 20;
        
        @Schema(description = "投诉状态筛选：pending-待审核，approved-投诉成立，rejected-投诉不成立")
        private String reportStatus;
        
        @Schema(description = "投诉类型筛选")
        private String reportType;
        
        @Schema(description = "作品编号")
        private String workNo;
        
        @Schema(description = "投诉人用户ID")
        private Long reporterId;
    }

    /**
     * 管理员投诉详情响应
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "管理员投诉详情响应")
    public static class AdminReportDetailResponse {
        
        @Schema(description = "投诉编号", example = "REPORT-20251114-001")
        private String reportNo;
        
        @Schema(description = "作品ID")
        private Long workId;
        
        @Schema(description = "作品编号", example = "WORK-20251026-001")
        private String workNo;
        
        @Schema(description = "作品标题")
        private String workTitle;
        
        @Schema(description = "作品结果URL")
        private String workResultUrl;
        
        @Schema(description = "投诉人用户ID")
        private Long reporterId;
        
        @Schema(description = "投诉人用户名")
        private String reporterUsername;
        
        @Schema(description = "投诉类型", example = "pornographic")
        private String reportType;
        
        @Schema(description = "投诉类型名称", example = "色情低俗")
        private String reportTypeName;
        
        @Schema(description = "投诉原因", example = "该作品包含不当内容")
        private String reportReason;
        
        @Schema(description = "投诉状态", example = "pending")
        private String reportStatus;
        
        @Schema(description = "投诉状态名称", example = "待审核")
        private String reportStatusName;
        
        @Schema(description = "审核管理员ID")
        private Long auditAdminId;
        
        @Schema(description = "审核管理员名称")
        private String auditAdminName;
        
        @Schema(description = "审核备注")
        private String auditRemark;
        
        @Schema(description = "审核时间")
        private LocalDateTime auditTime;
        
        @Schema(description = "投诉时间")
        private LocalDateTime createTime;
    }

    /**
     * 管理员投诉列表响应
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "管理员投诉列表响应")
    public static class AdminReportListResponse {
        
        @Schema(description = "投诉列表")
        private List<AdminReportDetailResponse> records;
        
        @Schema(description = "总记录数")
        private Long total;
        
        @Schema(description = "当前页码")
        private Integer page;
        
        @Schema(description = "每页数量")
        private Integer size;
        
        @Schema(description = "总页数")
        private Integer totalPages;
    }
}

