package com.cool.store.vo.order;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.cool.store.annotation.Excel;
import com.cool.store.enums.FranchiseBrandEnum;
import com.cool.store.enums.StoreTypeEnum;
import com.cool.store.enums.order.StoreOrderStatusEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
 * PC端-标准店订单列表VO
 */
@Data
public class PCStoreOrderListVO {

    @ApiModelProperty("订单ID")
    @ExcelIgnore
    private Long orderId;

    @ExcelProperty(value = "订单号", order = 1)
    @ApiModelProperty("订单号")
    @ColumnWidth(30)
    private String orderNo;

    @ExcelProperty(value = "加盟商姓名", order = 2)
    @ApiModelProperty("加盟商姓名")
    private String partnerName;

    @ExcelProperty(value = "手机号", order = 3)
    @ApiModelProperty("加盟商手机号")
    private String partnerMobile;

    @ApiModelProperty("门店名称")
    @ExcelProperty(value = "门店名称", order = 3)
    private String shopName;

    @ApiModelProperty("门店编码")
    @ExcelProperty(value = "门店编码", order = 3)
    private String shopCode;

    @ApiModelProperty("品牌")
    @ExcelIgnore
    private String brand;

    @ExcelProperty(value = "品牌", order = 4)
    @ApiModelProperty("品牌名称")
    private String brandName;


    @ApiModelProperty("门店类型")
    @ExcelIgnore
    private Integer storeType;

    @ExcelProperty(value = "门店类型名称", order = 5)
    @ApiModelProperty("门店类型名称")
    private String storeTypeName;

    @ExcelProperty(value = "店型名称", order = 6)
    @ApiModelProperty("店型名称")
    private String name;

    @ExcelProperty(value = "订单总额", order = 7)
    @ApiModelProperty("订单总额")
    private BigDecimal totalAmount;

    @ExcelProperty(value = "下单时间", order = 8)
    @ApiModelProperty("下单时间")
    @DateTimeFormat(value = "yyyy-MM-dd HH:mm:ss")
    private Date orderTime;

    @ExcelProperty(value = "加盟类费用总额", order = 9)
    @ApiModelProperty("加盟类费用总额")
    private BigDecimal storeFixedAmount;

    @ExcelProperty(value = "已支付金额", order = 7)
    @ApiModelProperty("已支付金额")
    private BigDecimal paidAmount;

    @ExcelProperty(value = "未支付金额", order = 8)
    @ApiModelProperty("未支付金额")
    private BigDecimal unpaidAmount;

    @ApiModelProperty("订单状态")
    @ExcelIgnore
    private Integer status;

    @ExcelProperty(value = "订单状态", order = 9)
    @ApiModelProperty("订单状态")
    private String statusName;

    public String getBrandName() {
        FranchiseBrandEnum enumByCode = FranchiseBrandEnum.getEnumByCode(this.brand);
        if (enumByCode==null){
            return null;
        }
        return enumByCode.getDesc();
    }

    public String getStoreTypeName() {
        return StoreTypeEnum.getMessage(this.getStoreType());
    }

    public String getStatusName() {
        StoreOrderStatusEnum enumByCode = StoreOrderStatusEnum.of(this.status);
        if (enumByCode==null){
            return null;
        }
        return enumByCode.getDesc();
    }
}
