package com.yonge.cooleshow.biz.dal.wrapper;

import com.alibaba.fastjson.JSON;
import com.microsvc.toolkit.common.response.paging.QueryInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;
import java.util.Optional;

/**
 * 曲谱伴奏表
 * 2022-12-07 10:16:58
 */
@ApiModel(value = "MusicSheetAccompanimentWrapper对象", description = "曲谱伴奏表查询对象")
public class MusicSheetAccompanimentWrapper {

    @Data
	@Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" MusicSheetAccompanimentQuery-曲谱伴奏表")
    public static class MusicSheetAccompanimentQuery implements QueryInfo {
    
    	@ApiModelProperty("当前页")
        private Integer page;
        
        @ApiModelProperty("分页行数")
        private Integer rows;
        
        @ApiModelProperty("关键字匹配")
		private String keyword;
        
        public String getKeyword() {
            return Optional.ofNullable(keyword).filter(StringUtils::isNotBlank).orElse(null);
        }
        
        public String jsonString() {
            return JSON.toJSONString(this);
        }

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

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
	@ApiModel(" MusicSheetAccompaniment-曲谱伴奏表")
    public static class MusicSheetAccompaniment {

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

        @ApiModelProperty("曲谱ID")
        private Long musicId;

        @ApiModelProperty("声部")
        private String musicSubject;

        @ApiModelProperty("MP3原声音频文件URL")
        private String audioFileUrl;

        @ApiModelProperty("map节拍器伴奏")
        private String metronomeUrl;

        @ApiModelProperty("伴奏轨迹")
        private String track;

        @ApiModelProperty("排序号")
        private Boolean sortNumber;

        @ApiModelProperty("速度")
        private Integer speed;

        @ApiModelProperty("曲目缓存")
        private String musicSvg;

        @ApiModelProperty("创建人(老师或者是后台平台用户)")
        private Long createBy;

        @ApiModelProperty("创建时间")
        private Date createTime;
        
        public String jsonString() {
            return JSON.toJSONString(this);
        }

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


        public MusicSheetAccompaniment musicId(Long musicId) {
            this.musicId = musicId;
            return this;
        }

        public MusicSheetAccompaniment musicSubject(String musicSubject) {
            this.musicSubject = musicSubject;
            return this;
        }

        public MusicSheetAccompaniment createBy(Long createBy) {
            this.createBy = createBy;
            return this;
        }
    }

}