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

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yonge.cooleshow.biz.dal.enums.AccountBizTypeEnum;
import com.yonge.cooleshow.common.enums.PostStatusEnum;
import com.yonge.toolset.base.page.QueryInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 机构流水表
 * 2023-07-31 13:47:30
 */
@ApiModel(value = "TenantAccountRecordWrapper对象", description = "机构流水表查询对象")
public class TenantAccountRecordWrapper {

    @Data
	@Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" TenantAccountRecordQuery-机构流水表")
    public static class TenantAccountRecordQuery extends QueryInfo {

        @ApiModelProperty("关联订单号")
        private String orderNo;

        @ApiModelProperty("业务编号")
        private Long bizId;

        @ApiModelProperty("收支类型（IN-收入  OUT-支出）")
        private String inOrOut;

        @ApiModelProperty("业务类型：PRACTICE、陪练课 LIVE、直播课 VIDEO、视频课 MUSIC、乐谱 ACTI_REGIST、活动报名 WITHDRAWAL、提现 " +
                "LIVE_SHARE、直播课分润 VIDEO_SHARE、视频课分润 MUSIC_SHARE、乐谱分润 VIP_SHARE、会员分润 MALL_SHARE、商品分润 ACTI_REGIST_SHARE、活动报名分润 ")
        private AccountBizTypeEnum bizType;

        @ApiModelProperty(value = "入账状态 WAIT 待入账 FROZEN 冻结入账 RECORDED 已入账 CANCEL 退费 ")
        private PostStatusEnum postStatus;

        @ApiModelProperty("记录开始时间")
        private Date startDate;

        @ApiModelProperty("记录结束时间")
        private Date endDate;


        @ApiModelProperty("机构ID")
        private Long tenantId;
        
        public String jsonString() {
            return JSON.toJSONString(this);
        }

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

    @Data
	@ApiModel(" TenantAccountRecord-机构流水表")
    public static class TenantAccountRecord {

        @ApiModelProperty("id")
        private Long id;

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

        @ApiModelProperty("机构名称")
        private String tenantName;

        @ApiModelProperty("交易金额")
        private BigDecimal transAmount;

        @ApiModelProperty("收支类型：IN、收入 OUT、支出")
        private String inOrOut;

        @ApiModelProperty("入账状态 WAIT 待入账 FROZEN 冻结入账 RECORDED 已入账 CANCEL 取消")
        private String postStatus;

        @ApiModelProperty("业务类型：PRACTICE、陪练课 LIVE、直播课 VIDEO、视频课 MUSIC、乐谱 WITHDRAWAL、提现 LIVE_SHARE、直播课分润 VIDEO_SHARE、视频课分润 MUSIC_SHARE、乐谱分润 VIP_SHARE、会员分润 MALL_SHARE、商品分润")
        private String bizType;

        @ApiModelProperty("业务id")
        private Long bizId;

        @ApiModelProperty("业务名称")
        private String bizName;

        @ApiModelProperty("订单号")
        private String orderNo;

        @ApiModelProperty("更新时间")
        @TableField(value = "update_time_")
        private Date updateTime;
        
        public String jsonString() {
            return JSON.toJSONString(this);
        }

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



    @Data
    @ApiModel(" TenantAccountRecordStat-机构流水表")
    public static class TenantAccountRecordStat {

        @ApiModelProperty("收入")
        private BigDecimal transAmountIn = BigDecimal.ZERO;

        @ApiModelProperty("支出")
        private BigDecimal transAmountOut = BigDecimal.ZERO;



        @ApiModelProperty("支出")
        private BigDecimal amountOut = BigDecimal.ZERO;
    }


    @Data
    @ApiModel(" TenantAccountRecordExport-机构收入导出")
    public static class TenantAccountRecordExport {

        @ApiModelProperty("id")
        @ExcelProperty("流水记录编号")
        private Long id;

        @ApiModelProperty("机构id")
        @ExcelProperty("机构编号")
        private Long tenantId;

        @ApiModelProperty("机构名称")
        @ExcelProperty("机构名称")
        private String tenantName;

        @ApiModelProperty("交易金额")
        @ExcelProperty("交易金额")
        private BigDecimal transAmount;

        @ApiModelProperty("收支类型：IN、收入 OUT、支出")
        @ExcelIgnore
        private String inOrOut;

        @ApiModelProperty("入账状态 WAIT 待入账 FROZEN 冻结入账 RECORDED 已入账 CANCEL 取消")
        @ExcelIgnore
        private String postStatus;

        @ApiModelProperty("业务类型：PRACTICE、陪练课 LIVE、直播课 VIDEO、视频课 MUSIC、乐谱 WITHDRAWAL、提现 LIVE_SHARE、直播课分润 VIDEO_SHARE、视频课分润 MUSIC_SHARE、乐谱分润 VIP_SHARE、会员分润 MALL_SHARE、商品分润")
        @ExcelProperty("收入类型")
        private String bizType;

        @ApiModelProperty("业务id")
        @ExcelIgnore
        private Long bizId;

        @ApiModelProperty("业务名称")
        @ExcelIgnore
        private String bizName;

        @ApiModelProperty("订单号")
        @ExcelProperty("订单号")
        private String orderNo;

        @ApiModelProperty("更新时间")
        @ExcelProperty("更新时间")
        private Date updateTime;

        @ApiModelProperty("是否结算")
        @ExcelProperty("是否完成结算")
        private String settlement;

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

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

}