package com.xy.dto;

import cn.hutool.core.date.DateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xy.utils.Emptys;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;

public class MercMiniDeviceDto {

    @Data
    @Accessors(chain = true)
    public static class ListOfIdNameVo {
        @ApiModelProperty("设备id")
        private Long deviceId;

        @ApiModelProperty("设备名称")
        private String deviceName;

        public String getDeviceName() {
            return Emptys.check(deviceName) ? deviceName : String.valueOf(deviceId);
        }
    }

    @Data
    @Accessors(chain = true)
    public static class UpdateInfo {
        @NotNull(message = "deviceId不能为空")
        @ApiModelProperty("设备id")
        private Long deviceId;

        @ApiModelProperty("设备名称")
        private String deviceName;

        @ApiModelProperty("点位id")
        private Long placeId;

        @ApiModelProperty("线路id")
        private Long placeLineId;

        @ApiModelProperty("区域id")
        private Long districtId;

        @ApiModelProperty("经度")
        private String lon;

        @ApiModelProperty("纬度")
        private String lat;

    }

    @Data
    @Accessors(chain = true)
    public static class Active {

        @NotNull(message = "deviceId不能为空")
        @ApiModelProperty("设备id")
        private Long deviceId;

    }

    @Data
    @Accessors(chain = true)
    public static class Active2 {

        @NotEmpty(message = "deviceId不能为空")
        @ApiModelProperty("设备id")
        private List<Long> deviceId;

        @ApiModelProperty(value = "验证管理费", hidden = true)
        private Boolean isDeviceCharging = true;

        @ApiModelProperty(value = "验证算法费", hidden = true)
        private Boolean isDeviceAlgorithmCharging = true;
    }

    @Data
    @Accessors(chain = true)
    public static class RestActive {

        @NotNull(message = "deviceId不能为空")
        @ApiModelProperty("设备id")
        private Long deviceId;
        @ApiModelProperty("nfcSN")
        private String nfcSn;

    }

    @Data
    @Accessors(chain = true)
    public static class ActiveVo {

        @ApiModelProperty("设备id")
        private Long deviceId;

        @ApiModelProperty("状态码")
        private Integer code;

        @ApiModelProperty("状态说明")
        private String msg;

    }

    @Data
    @Accessors(chain = true)
    public static class BusySate {

        @NotNull(message = "设备运营状态不能为空")
        @ApiModelProperty("设备运营状态 1 运营中 2 已停运")
        private Integer busyState;

        @NotNull(message = "deviceId不能为空")
        @ApiModelProperty("设备id")
        private Long deviceId;


        @ApiModelProperty(value = "商户id", hidden = true)
        private Long mercId;
    }

    @Data
    @Accessors(chain = true)
    public static class HomePageVO {

        @Valid
        @ApiModelProperty(value = "今日数据")
        private DayCountVO day;

        @Valid
        @ApiModelProperty(value = "本月数据")
        private MonthCountVO month;

    }

    @Data
    @Accessors(chain = true)
    public static class HomePageMonthDTO {

        @ApiModelProperty(value = "日期", required = false)
        @JsonFormat(pattern = "yyyy-MM")
        private DateTime date;
    }

    @Data
    @Accessors(chain = true)
    public static class HomePageDayDTO {
        @JsonFormat(pattern = "yyyy-MM-dd")
        private DateTime date;
    }

    @Data
    @Accessors(chain = true)
    public static class HomePageMonthVO {
        @ApiModelProperty(value = "本月收款")
        private Integer monthReceivedMoney;
        @ApiModelProperty(value = "本月销售-订单金额")
        private Integer monthOrderTotalMoney;

        @ApiModelProperty(value = "本月销售-到账金额")
        private Integer monthOrderRealMoney;
        @ApiModelProperty(value = "本月销售-数量")
        private Integer monthOrderNum;

        @ApiModelProperty(value = "本月订单-未收款金额")
        private Integer noPaymentMoney;

        @ApiModelProperty(value = "历史订单-未收款金额")
        private Integer hisNoPaymentMoney;
    }

    @Data
    @Accessors(chain = true)
    public static class HomePageDayVO {
        @ApiModelProperty(value = "今日收款")
        private Integer todayReceivedMoney;
        @ApiModelProperty(value = "今日补收-金额")
        private Integer todayFillMoney;
        @ApiModelProperty(value = "今日补收-数量")
        private Integer todayFillOrderNum;

        @ApiModelProperty(value = "今日补退-金额")
        private Integer todayHisRefundMoney;

        @ApiModelProperty(value = "今日补退-数量")
        private Integer todayHisOrderRefundNum;

        @ApiModelProperty(value = "今日退款-金额")
        private Integer todayOrderRefundMoney;

        @ApiModelProperty(value = "今日退款-数量")
        private Integer todayOrderRefundNum;

        @ApiModelProperty(value = "今日销售-订单金额")
        private Integer todayOrderTotalMoney;

        @ApiModelProperty(value = "今日销售-到账金额")
        private Integer todayOrderRealMoney;
        @ApiModelProperty(value = "今日销售-数量")
        private Integer todayOrderNum;

        @ApiModelProperty(value = "风险单-待处理数量")
        private Integer toDoRiskOrderCount;

        @ApiModelProperty(value = "风险单-今日处理数量")
        private Integer toDayHandleRiskOrderCount;
        @ApiModelProperty(value = "风险单-今日新增数量")
        private Integer toDayNewRiskOrderCount;


    }

    @Data
    @Accessors(chain = true)
    public static class DayCountVO {
        @ApiModelProperty(name = "订单总成本价")
        private Integer orderTotalPriceCost;

        @ApiModelProperty("订单数")
        private Integer orderNum;

        @ApiModelProperty("销售额")
        private Integer salesPrice;

        @ApiModelProperty("退款金额")
        private Integer refundMoney;

        @ApiModelProperty("订单金额")
        private Integer orderTotalMoney;

        @ApiModelProperty(name = "退款订单数")
        private Integer refundOrdersSize;


        @ApiModelProperty(name = "补收金额")
        private Integer cutPayMoney;


        @ApiModelProperty(name = "补收订单数")
        private Integer cutOrdersSize;


        @ApiModelProperty(name = "补退金额")
        private Integer cutRefundMoney;

        @ApiModelProperty(name = "补退订单数")
        private Integer cutRefundOrdersSize;

        @ApiModelProperty(value = "到账金额=付款金额-退款金额")
        private Integer dayOrderRealMoney;

        @ApiModelProperty(value = "今日毛利率 （销售额-成本）/销售额")
        private BigDecimal grossProfitMargin;

        @ApiModelProperty(value = "昨日毛利率 （销售额-成本）/销售额")
        private BigDecimal hisGrossProfitMargin;

        @ApiModelProperty(value = "今日利润")
        private Integer dayProfit;


    }

    @Data
    @Accessors(chain = true)
    public static class MonthCountVO {

        @ApiModelProperty("订单数")
        private Integer orderNum;

        @ApiModelProperty("销售额")
        private Integer salesPrice;

        @ApiModelProperty("退款金额")
        private Integer refundMoney;

        @ApiModelProperty(value = "本月利润")
        private Integer monthProfit;


    }


}
