package com.eactive.eai.rms.data.entity.onl.kjb.statistics;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import lombok.Getter;
import lombok.Setter;

/**
 * API Gateway 시간별 처리 통계
 */
@Getter
@Setter
@Entity
@Table(name = "API_STATS_HOUR")
@IdClass(ApiStatsHourId.class)
public class ApiStatsHour implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "STAT_TIME", nullable = false)
	private LocalDateTime statTime;

	@Id
	@Column(name = "API_NAME", nullable = false, length = 100)
	private String apiName;

	@Id
	@Column(name = "GW_INSTANCE_ID", nullable = false, length = 50)
	private String gwInstanceId;

	@Id
	@Column(name = "BIZ_DIV_CODE", nullable = false, length = 50)
	private String bizDivCode = "NONE";

	@Id
	@Column(name = "CLIENT_ID", nullable = false, length = 100)
	private String clientId = "NONE";

	@Id
	@Column(name = "INBOUND_ADAPTER", nullable = false, length = 100)
	private String inboundAdapter = "NONE";

	@Id
	@Column(name = "OUTBOUND_ADAPTER", nullable = false, length = 100)
	private String outboundAdapter = "NONE";

	@Column(name = "TOTAL_CNT", nullable = false)
	private Long totalCnt = 0L;

	@Column(name = "SUCCESS_CNT", nullable = false)
	private Long successCnt = 0L;

	@Column(name = "TIMEOUT_CNT", nullable = false)
	private Long timeoutCnt = 0L;

	@Column(name = "SYSTEM_ERR_CNT", nullable = false)
	private Long systemErrCnt = 0L;

	@Column(name = "BIZ_ERR_CNT", nullable = false)
	private Long bizErrCnt = 0L;

	@Column(name = "SEQ900_TIMEOUT_CNT", nullable = false)
	private Long seq900TimeoutCnt = 0L;

	@Column(name = "SEQ900_SYSTEM_ERR_CNT", nullable = false)
	private Long seq900SystemErrCnt = 0L;

	@Column(name = "SEQ900_BIZ_ERR_CNT", nullable = false)
	private Long seq900BizErrCnt = 0L;

	@Column(name = "AVG_RESP_TIME", precision = 10, scale = 3)
	private BigDecimal avgRespTime = BigDecimal.ZERO;

	@Column(name = "MIN_RESP_TIME", precision = 10, scale = 3)
	private BigDecimal minRespTime = BigDecimal.ZERO;

	@Column(name = "MAX_RESP_TIME", precision = 10, scale = 3)
	private BigDecimal maxRespTime = BigDecimal.ZERO;

	@Column(name = "P50_RESP_TIME", precision = 10, scale = 3)
	private BigDecimal p50RespTime = BigDecimal.ZERO;

	@Column(name = "P95_RESP_TIME", precision = 10, scale = 3)
	private BigDecimal p95RespTime = BigDecimal.ZERO;
}
