package com.yonge.cooleshow.admin.io.request;

import com.alibaba.fastjson.JSON;
import com.yonge.cooleshow.biz.dal.enums.SubjectTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 机构专辑
 * 2023-07-28 10:17:46
 */
@Data
@Builder
@NoArgsConstructor
@ApiModel(value = "TenantAlbumVo对象", description = "机构专辑查询视图对象")
public class TenantAlbumVo {


    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" TenantAlbum-机构专辑")
    public static class TenantAlbum {

        @ApiModelProperty("主键ID")
        private Long id;

        @ApiModelProperty("机构ID")
        private Long tenantId;

        @ApiModelProperty("专辑名称")
        private String name;

        @ApiModelProperty("专辑介绍")
        private String describe;

        @ApiModelProperty("专辑封面")
        private String coverImg;

        @ApiModelProperty("平台价格")
        private BigDecimal originalPrice;

        @ApiModelProperty("机构价格")
        private BigDecimal salePrice;

        @ApiModelProperty("购买周期")
        private Integer purchaseCycle;

        @ApiModelProperty("原价")
        private BigDecimal costPrice;

        @ApiModelProperty("曲目相关信息")
        private List<MusicSheetData> musicSheetData = new ArrayList<>();

        @ApiModelProperty("专辑分类类型ID")
        private Long categoryTypeId;

        @ApiModelProperty("专辑分类等级ID")
        private Long categoryLevelId;

        @ApiModelProperty("采购周期类型")
        private String purchaseTypes;

        @ApiModelProperty("专辑采购金额")
        private String purchaseJson;

        public String jsonString() {
            return JSON.toJSONString(this);
        }

        public static TenantAlbum from(String json) {
            return JSON.parseObject(json, TenantAlbum.class);
        }
    }

    @ApiModel("声部模型")
    @Data
    public static class MusicSheetData {

        @ApiModelProperty("声部类型")
        @NotNull
        private SubjectTypeEnum subjectType;

        @ApiModelProperty("曲目列表")
        private List<MusicObject> musicSheetList = new ArrayList<>();

    }

    @ApiModel("曲目对象")
    @Data
    public static class MusicObject {

        @ApiModelProperty("曲目id")
        private Long id;

        @ApiModelProperty("类型")
        private String type;

        @ApiModelProperty("级别")
        private String level;


    }




    @Data
    public static class tenantAlbumMusics {
        private Long id;
        private Long tenantId;
        private SubjectTypeEnum subjectType;
        private Long tenantAlbumId;
        private Long musicSheetId;
        private Integer sortNumber;
        private Boolean delFlag;
        private Date updateTime;
        private Date createTime;
    }


    @Data
    @ApiModel("专辑启用/停用")
    public static class UpdateStatus {

        @ApiModelProperty("专辑ID")
        @NotNull
        private Long id;

        @ApiModelProperty("启用/停用")
        @NotNull
        private Boolean status;
    }

}