package com.zt.plat.module.qms.resource.record.controller.admin.onlyOffice.controller.vo;

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

@Schema(description = "管理后台 - OnlyOffice 编辑器配置 Response VO")
@Data
public class OnlyOfficeEditorConfigRespVO {

    @Schema(description = "文档类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "text")
    private String documentType;

    @Schema(description = "文档配置", requiredMode = Schema.RequiredMode.REQUIRED)
    private DocumentConfig document;

    @Schema(description = "编辑器配置", requiredMode = Schema.RequiredMode.REQUIRED)
    private EditorConfig editorConfig;

    @Schema(description = "文档高度", requiredMode = Schema.RequiredMode.REQUIRED, example = "100%")
    private String height;

    @Schema(description = "令牌", requiredMode = Schema.RequiredMode.REQUIRED)
    private String token;

    @Schema(description = "OnlyOffice服务器地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "http://localhost:8085")
    private String documentServerUrl;

    @Schema(description = "文档配置")
    @Data
    public static class DocumentConfig {
        @Schema(description = "文件类型", example = "docx")
        private String fileType;

        @Schema(description = "文档key", example = "doc123")
        private String key;

        @Schema(description = "文档标题", example = "技术文档")
        private String title;

        @Schema(description = "文档地址")
        private String url;

        @Schema(description = "权限配置")
        private Permissions permissions;
    }

    @Schema(description = "权限配置")
    @Data
    public static class Permissions {
        @Schema(description = "是否可编辑", example = "true")
        private Boolean edit;

        @Schema(description = "是否可下载", example = "true")
        private Boolean download;

        @Schema(description = "是否可打印", example = "true")
        private Boolean print;
    }

    @Schema(description = "编辑器配置")
    @Data
    public static class EditorConfig {
        @Schema(description = "回调地址")
        private String callbackUrl;

        @Schema(description = "语言", example = "zh-CN")
        private String lang;

        @Schema(description = "模式", example = "edit")
        private String mode;

        @Schema(description = "用户配置")
        private User user;

        @Schema(description = "协作配置")
        private CoEditing coEditing;
    }

    @Schema(description = "用户配置")
    @Data
    public static class User {
        @Schema(description = "用户ID", example = "1")
        private String id;

        @Schema(description = "用户名", example = "admin")
        private String name;
    }

    @Schema(description = "协作配置")
    @Data
    public static class CoEditing {
        @Schema(description = "协作模式", example = "fast")
        private String mode;

        @Schema(description = "是否允许更改", example = "true")
        private Boolean change;
    }

}