package org.jeecg.modules.app.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.modules.system.app.entity.AppInsure;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

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

@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description="公共订单相关返回参数")
public class OrderVO {
    @Data
    @Accessors(chain = true)
    @EqualsAndHashCode(callSuper = false)
    @Schema(description="学校场地预约-预览页")
    public static class PreviewOrderPlaceSchool {
        @Schema(description = "门店ID")
        private String id;
        @Schema(description = "门店名称")
        private String name;
        @Schema(description="学校场地预约-预览页-时间段")
        private List<PreviewOrderPlaceSchoolChild> timeSlot;

        @Schema(description = "保险")
        private String  insureIds;
        @Schema(description = "保险列表")
        private List<AppInsure>  insureIdList;

    }

    @Data
    @Accessors(chain = true)
    @EqualsAndHashCode(callSuper = false)
    @Schema(description="学校场地预约-预览页-时间段")
    public static class PreviewOrderPlaceSchoolChild {
        @Schema(description = "时间段ID")
        private String id;
        @Schema(description = "时间段名称")
        private String name;
        /**开始时间*/
        @Excel(name = "开始时间", width = 20, format = "HH:mm:ss")
        @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
        @DateTimeFormat(pattern="HH:mm:ss")
        @Schema(description = "开始时间")
        private Date startTime;
        /**结束时间*/
        @Excel(name = "结束时间", width = 20, format = "HH:mm:ss")
        @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
        @DateTimeFormat(pattern="HH:mm:ss")
        @Schema(description = "结束时间")
        private Date endTime;
        @Schema(description = "库存")
        private int inventory;
        private int isTeaching;
        @Schema(description = "价格")
        private BigDecimal price = BigDecimal.ZERO;

    }

    @Data
    @Accessors(chain = true)
    @EqualsAndHashCode(callSuper = false)
    @Schema(description="教学日非教学日解析")
    public static class TimeSlotData {
        private String ticketNum;
        private String startTime;
        private String endTime;

    }

    @Data
    @Accessors(chain = true)
    @EqualsAndHashCode(callSuper = false)
    @Schema(description="课程购买-预览页")
    public static class PreviewOrderCourse {
        @Schema(description = "课程ID")
        private String id;
        @Schema(description = "课程名称")
        private String name;
        @Schema(description = "课程图片")
        private String cover;
        @Schema(description = "商品价格")
        private BigDecimal sellingPrice;
        @Schema(description = "优惠")
        private BigDecimal discountPrice;
        @Schema(description = "总优惠")
        private BigDecimal totalDiscount;
        @Schema(description = "是否有优惠")
        private Boolean hasDiscount;
        @Schema(description = "小计")
        private BigDecimal subtotal;
        @Schema(description = "总价")
        private BigDecimal totalPrice;
        @Schema(description = "提示")
        private String reminder;

        @Schema(description = "保险列表")
        private List<AppInsure>  insureIdList;
    }

    @Data
    @Accessors(chain = true)
    @EqualsAndHashCode(callSuper = false)
    @Schema(description="体育馆包场-预览页")
    public static class PreviewOrderPlaceGymnasiumChartered {
        @Schema(description = "场地ID")
        private String placeId;
        private String cover;
        @Schema(description = "体育馆包场提前退款时间；单位：分钟")
        private int earlyRefundTime;
        @Schema(description = "门店名称")
        private String storeName;
        @Schema(description = "场地名称")
        private String placeName;
        @Schema(description = "商品总价")
        private BigDecimal totalPrice;
        @Schema(description = "小计")
        private BigDecimal subtotal;
        @Schema(description = "购买人手机号")
        private String mobile;
        @Schema(description = "提示")
        private String reminder;
        @Schema(description = "退改规则")
        private int refundRule;
        @Schema(description="体育馆包场-时间段-预览页")
        private List<PreviewOrderTimePeriod> timePeriod;

    }

    @Data
    @Accessors(chain = true)
    @EqualsAndHashCode(callSuper = false)
    @Schema(description="体育馆无固定场-预览页")
    public static class PreviewOrderPlaceGymnasiumNoFixation {
        @Schema(description = "场地ID")
        private String placeId;
        @Schema(description = "场地名称")
        private String name;
        @Schema(description = "原价")
        private BigDecimal originalPrice = BigDecimal.ZERO;
        @Schema(description = "售价")
        private BigDecimal sellingPrice = BigDecimal.ZERO;
        @Schema(description = "购买须知")
        private String reminder;
        @Schema(description = "有效期")
        private int indate;
        @Schema(description = "营业时间开始")
        @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
        @DateTimeFormat(pattern="HH:mm:ss")
        private Date startTime;
        @Schema(description = "营业时间结束")
        @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
        @DateTimeFormat(pattern="HH:mm:ss")
        private Date endTime;
        @Schema(description = "提前预约时间")
        private int advanceTime;
        @Schema(description = "适用人数")
        private int usableCount;
        @Schema(description = "退款规则 退款类型;0可退/到期自动退 1限时退 2不可退")
        private int refundType;
        @Schema(description = "封面图片")
        private String cover;
        private List<String> downTime;
        private String downTimes;
    }

    @Data
    @Accessors(chain = true)
    @EqualsAndHashCode(callSuper = false)
    @Schema(description="体育馆包场-时间段-预览页")
    public static class PreviewOrderTimePeriod{
        @Schema(description = "时间段ID")
        private String id;
        @Schema(description = "时间段名称")
        private String name;
        @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
        @DateTimeFormat(pattern="HH:mm:ss")
        @Schema(description = "开始时间")
        private Date startTime;
        @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
        @DateTimeFormat(pattern="HH:mm:ss")
        @Schema(description = "结束时间")
        private Date endTime;
    }
    @Data
    @Accessors(chain = true)
    @EqualsAndHashCode(callSuper = false)
    @Schema(description="学校场地预约-创建订单")
    public static class createOrderPlaceSchool{
        @Schema(description = "订单ID")
        private String id;
        /** 预订信息**/
        @Schema(description = "订单状态0初始 1、支付中 2、待使用 3、已使用 4、待评价 5、退款中 6、已退款")
        private int orderStatus;
        @Schema(description = "场地名称")
        private String placeName;
        @Schema(description = "时间段")
        private String timeSlot;
        @Schema(description = "日期")
        private Date date;
        @Schema(description = "用户名称")
        private String userName;
        @Schema(description = "地址")
        private String address;
        @Schema(description ="经度")
        private BigDecimal longitude;
        @Schema(description ="纬度")
        private BigDecimal latitude;
        @Schema(description = "使用须知")
        private String reminder;
        /** 订单信息**/
        @Schema(description = "订单编号")
        private String orderCode;
        @Schema(description = "手机号")
        private String mobile;
        @Schema(description = "实际付款")
        private BigDecimal price;
        @Schema(description = "下单时间")
        private Date createTime;
        @Schema(description = "支付时间")
        private Date payTime;
        @Schema(description = "学校场地预约-券号信息")
        private List<couponNumberInformation> couponNumberInformation;
    }

    @Data
    @Accessors(chain = true)
    @EqualsAndHashCode(callSuper = false)
    @Schema(description="学校场地预约-券号信息")
    public static class couponNumberInformation{
        @Schema(description = "券ID")
        private String id;
        @Schema(description = "用户名称")
        private String userName;
        @Schema(description = "券号")
        private String couponCode;
        @Schema(description = "券状态")
        private int couponStatus;
        @Schema(description = "到期时间")
        private String expireTime;
    }
    @Data
    @Accessors(chain = true)
    @EqualsAndHashCode(callSuper = false)
    @Schema(description="学校包场-预览时间选择")
    public static class PreviewOrderPlaceSchoolTime{
        @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
        @DateTimeFormat(pattern = "yyyy-MM-dd")
        @Schema(description = "日期")
        private Date day;
        @Schema(description = "当前剩余库存")
        private int inventory;
        private int isTeaching;
        @Schema(description = "简称")
        private String namedDay;
    }
}
