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.Data;
import org.springframework.format.annotation.DateTimeFormat;

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

/**
 * 公有云账单
 *
 * @author admin
 */
@Table("cloud_bill")
@Data
public class CloudBill extends Generic {

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

    @Column("region_id")
    private String regionId;

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

    @Column("resource_id")
    private String resourceId;

    @Column("product_detail")
    private String productDetail;
    @Column("product_name")
    private String productName; // 子产品
    @Column("product_code")
    private String productCode;

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

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

    /**
     * 计费类型
     */
    @Column("charge_mode")
    private String chargeMode;
    /**
     * 原价
     */
    @Column("total_cost")
    private BigDecimal totalCost;

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

    @IgnoreAll
    private String regionName;

    @Column("subscription_type")
    private String subscriptionType;// 订阅类型
    @Column("deducted_byCashoupons")
    private BigDecimal deductedByCashCoupons;// 现金券扣除
    @Column("deducted_byCoupons")
    private BigDecimal deductedByCoupons;// 优惠券扣除
    @Column("deducted_byPrepaidCard")
    private BigDecimal deductedByPrepaidCard;// 预付卡扣款
    @Column("invoice_discount")
    private BigDecimal invoiceDiscount;// 发票扣款
    @Column("outstanding_amount")
    private BigDecimal outstandingAmount;// 未付金额
    @Column("pretax_amount")
    private BigDecimal pretaxAmount;// 税前金额
    @Column("pretax_gross_amount")
    private BigDecimal pretaxGrossAmount;// 税前总额
    @Column("round_down_discount")
    private BigDecimal roundDownDiscount;// 四舍五入折扣
    //-azure
    @Column("subscription_id")
    private String subscriptionId;//订阅ID
    @Column("consumed_service")
    private String consumedService;//资源服务类别  云主机/硬盘。。。。
    @Column("unit_price")
    private BigDecimal unitPrice;
    @Column("quantity")
    private BigDecimal quantity;//使用数量

    /**
     * 公有云上面的项目名称
     */
    @Column("project_name")
    private String projectName;
}
