package com.izouma.nineth.dto;

import com.alibaba.excel.annotation.ExcelProperty;
import com.izouma.nineth.annotations.Searchable;
import com.izouma.nineth.domain.GiftOrder;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDateTime;

@Data
public class GiftOrderDTO {
    @ExcelProperty("ID")
    private Long id;

    @ExcelProperty("赠送用户ID")
    private Long userId;

    @ExcelProperty("赠送用户昵称")
    private String nickname;

    @ExcelProperty("藏品ID")
    private Long collectionId;

    @ExcelProperty("名称")
    private String name;

    @ExcelProperty("收到用户ID")
    private Long toUserId;

    @ExcelProperty("收到用户昵称")
    private String toNickname;

    @ExcelProperty("支付方式")
    private String payMethod;

    @ExcelProperty("状态")
    private String status;

    @ExcelProperty("gas费")
    @Column(precision = 10, scale = 2)
    private BigDecimal gasPrice;

    @ExcelProperty("交易ID")
    @Searchable
    private String transactionId;

    @ExcelProperty("支付时间")
    private LocalDateTime payTime;

    @ExcelProperty("交易hash")
    private String txHash;

    @ExcelProperty("消耗gas")
    private BigInteger gasUsed;

    @ExcelProperty("区块高度")
    private BigInteger blockNumber;

    @ExcelProperty("项目ID")
    private int projectId;

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

    @ApiModelProperty("下单用户IP")
    private String ip;

    public GiftOrderDTO(GiftOrder go) {
        BeanUtils.copyProperties(go, this);
    }
}
