package com.bocloud.ims.entity.resource;

import com.bocloud.common.utils.DateDeserializer;
import com.bocloud.common.utils.DateSerializer;
import com.bocloud.entity.annotations.*;
import com.bocloud.entity.bean.Generic;
import com.bocloud.entity.meta.PKStrategy;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

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

/**
 * 公有云账单
 *
 * @author admin
 */
@Table("tenant_cloud_bill")
public class TenantCloudBill extends Generic {

    /**
     * id
     */
    @Setter
    @Getter
    @PK(PKStrategy.AUTO)
    private Long id;
    /**
     * 流水号
     */
    @Setter
    @Getter
    @Column("order_sn")
    private String orderSn;

    @Setter
    @Getter
    @Column("vendor_type")
    private String vendorType;
    /**
     * 平台id
     */
    @Setter
    @Getter
    @Column("vendor_id")
    private Long vendorId;
    /**
     * 状态
     */
    @Setter
    @Getter
    @Column("status")
    private String status;
    /**
     * 账单金额
     */
    @Setter
    @Getter
    @Column("money")
    private BigDecimal money;
    /**
     * 租户id
     */
    @Setter
    @Getter
    @Column("user_id")
    private Long userId;
    /**
     * 项目id
     */
    @Setter
    @Getter
    @Column("project_id")
    private Long projectId;
    /**
     * 租户id
     */
    @Setter
    @Getter
    @Column("tenant_id")
    private Long tenantId;
    /**
     * 账期
     */
    @Setter
    @Getter
    @Column("month")
    private String month;
    /**
     * 创建时间
     */
    @Setter
    @Getter
    @IgnoreUpdate
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column("gmt_create")
    private Date gmtCreate;
    @Setter
    @Getter
    @Column("params")
    private String params;

    @Setter
    @Getter
    @Column("resource_id")
    private String resourceId;

    @Setter
    @Getter
    @Column("product_detail")
    private String productDetail;
    @Setter
    @Getter
    @Column("product_name")
    private String productName; // 子产品
    @Setter
    @Getter
    @Column("product_code")
    private String productCode;
    /**
     * 租户金额
     */
    @Setter
    @Getter
    @Column("tenant_money")
    private BigDecimal tenantMoney;


    /**
     * 创建时间
     */
    @Setter
    @Getter
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column("fee_begin_time")
    private Date feeBeginTime;

    /**
     * 创建时间
     */
    @Setter
    @Getter
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column("fee_end_time")
    private Date feeEndTime;

    /**
     * 计费类型
     */
    @Setter
    @Getter
    @Column("charge_mode")
    private String chargeMode;

    /**
     * 平台名称
     */
    @Setter
    @Getter
    @IgnoreAll
    private String vendorName;

    @Setter
    @Getter
    @Column("subscription_type")
    private String subscriptionType;// 订阅类型
    @Setter
    @Getter
    @Column("deducted_byCashoupons")
    private BigDecimal deductedByCashCoupons;// 现金券扣除
    @Setter
    @Getter
    @Column("deducted_byCoupons")
    private BigDecimal deductedByCoupons;// 优惠券扣除
    @Setter
    @Getter
    @Column("deducted_byPrepaidCard")
    private BigDecimal deductedByPrepaidCard;// 预付卡扣款
    @Setter
    @Getter
    @Column("invoice_discount")
    private BigDecimal invoiceDiscount;// 发票扣款
    @Setter
    @Getter
    @Column("outstanding_amount")
    private BigDecimal outstandingAmount;// 未付金额
    @Setter
    @Getter
    @Column("pretax_amount")
    private BigDecimal pretaxAmount;// 税前金额
    @Setter
    @Getter
    @Column("pretax_gross_amount")
    private BigDecimal pretaxGrossAmount;// 税前总额
    @Setter
    @Getter
    @Column("round_down_discount")
    private BigDecimal roundDownDiscount;// 四舍五入折扣
    /**
     * 原价
     */
    @Setter
    @Getter
    @Column("total_cost")
    private BigDecimal totalCost;
    //----------------azure---
    @Setter
    @Getter
    @Column("subscription_id")
    private String subscriptionId;//订阅ID
    @Setter
    @Getter
    @Column("resource_group_name")
    private String resourceGroupName;//资源组
    @Setter
    @Getter
    @Column("quantity")
    private BigDecimal quantity;//使用数量
    @Setter
    @Getter
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column("use_resource_data")
    private Date useResourceData;//使用记录的日期
    @Setter
    @Getter
    @Column("unit_price")
    private BigDecimal unitPrice;//单价是适用于您的价格。 （您的 EA 或其他合同价格）。
    @Setter
    @Getter
    @Column("billing_currency")
    private String billingCurrency;//计费币种。
    @Setter
    @Getter
    @Column("order_sn_name")
    private String orderSnName; // 订单名称
    @Setter
    @Getter
    @Column("consumed_service")
    private String consumedService;//资源服务类别  Microsoft.Compute/Microsoft.Network
    @Setter
    @Getter
    @Column("region_id")
    private String regionId;
    @Setter
    @Getter
    @Column("resource_name")
    private String resourceName; // 资源实例名称
    @Setter
    @Getter
    @IgnoreAll
    private String regionName;


}
