package com.cf.imes.module.system.controller.admin.funds.purchase.vo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cf.imes.framework.excel.core.annotations.EnumFormat;
import com.cf.imes.framework.excel.core.convert.EnumConvert;
import com.cf.imes.framework.jackson.core.databind.LocalDateSerializer;
import com.cf.imes.module.system.enums.pay.ProductDurationUnitEnum;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;


@Data
public class PurchaseRecordRespVO {


    @Schema(description = "订单号")
    @ExcelProperty("excel.export.head.purchase.record.id")
    private Long id;

    @Schema(description = "组织ID")
    @ExcelIgnore
    private Long organId;

    @Schema(description = "组织名称")
    @ExcelProperty("excel.export.head.purchase.record.organName")
    private String organName;

    @Schema(description = "产品名称")
    @ExcelProperty("excel.export.head.purchase.record.product.name")
    private String productName;

    @Schema(description = "购买时长", example = "1")
    @ExcelProperty("excel.export.head.purchase.record.purchase.duration")
    private Integer purchaseDuration;

    @Schema(description = "购买时长单位，0：年、1：月", example = "1")
    @ExcelProperty(value = "excel.export.head.purchase.record.purchase.duration.unit", converter = EnumConvert.class)
    @EnumFormat(value = ProductDurationUnitEnum.class)
    private Integer purchaseDurationUnit;

    @Schema(description = "赠送时长", example = "1")
    @ExcelProperty("excel.export.head.purchase.record.gift.duration")
    private Integer giftDuration;

    @Schema(description = "赠送时长单位，0：年、1：月", example = "1")
    @ExcelProperty(value = "excel.export.head.purchase.record.gift.duration.unit", converter = EnumConvert.class)
    @EnumFormat(value = ProductDurationUnitEnum.class)
    private Integer giftDurationUnit;

    @Schema(description = "支付方式")
    @ExcelProperty("excel.export.head.purchase.record.payment.method")
    private String paymentMethod;

    @Schema(description = "订单总额")
    @ExcelProperty("excel.export.head.purchase.record.total.amount")
    private BigDecimal totalAmount;

    @Schema(description = "扫码支付")
    @ExcelProperty("excel.export.head.purchase.record.external.spent")
    private BigDecimal externalSpent;

    @Schema(description = "购买时间")
    @ExcelProperty("excel.export.head.purchase.record.create.time")
    private LocalDateTime createTime;

    @Schema(description = "操作人")
    @ExcelProperty("excel.export.head.purchase.record.creator")
    private String creator;

    @Schema(description = "产品有效时间")
    @ExcelProperty("excel.export.head.purchase.record.end.time")
    @JsonSerialize(using = LocalDateSerializer.class)
    private LocalDate endTime;

    @Schema(description = "支付状态")
    private Integer payStatus;
}
