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

import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Table("cloud_cost")
public class CloudCost extends Generic {
    @PK(value = PKStrategy.AUTO)
    // ID
    private Long id;
    @Column("start")
    private Date start;
    @Column("end")
    private Date end;
    @Column("group_uuid")
    private String groupUuid;
    @Column("amount")
    private String amount;
    @Column("unit")
    private String unit;
    // 粒度
    @Column("granularity")
    private String granularity;
    // 指标
    @Column("metrics")
    private String metrics;
    // 维度
    @Column("dimension")
    private String dimension;
    @Column("vendor_id")
    private Long vendorId;
    @IgnoreUpdate
    @Column(value = "gmt_create", nullable = false)
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gmtCreate;
    @Column("gmt_modify")
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gmtModify;

    /**
     * 流水号
     */
    @IgnoreAll
    private String sequenceId;

    /**
     * ip
     */
    @IgnoreAll
    private String managerIp;

    @IgnoreAll
    private String privateIps;
}