package com.bocloud.cmp.model.common;

import com.bocloud.common.utils.DateDeserializer;
import com.bocloud.common.utils.DateSerializer;
import com.bocloud.nms.enums.OrderItemStatus;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.*;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

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

/**
 * 订单明细
 *
 * @author wangyu
 * @version 1.0
 * @since 2020年3月10日
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
public class OrderItem {

	/**
	 * id
	 */

	private Long id;
	/**
	 * 子订单编号
	 */

	private String sn;
	/**
	 * 订单id
	 */

	private Long orderId;
	/**
	 * 订单类别(complex|single)
	 */

	private Catalog catalog;
	/**
	 * sku id
	 */

	private Long skuId;
	/**
	 * 资源状态
	 */

	private OrderItemStatus status;
	/**
	 * 基础价格
	 */

	private BigDecimal basicPrice;
	/**
	 * 最终价格
	 */

	private BigDecimal finalPrice;
	/**
	 * 订购时长信息 {"mode":"Hour|Month","month":12}
	 */

	private String duration;
	/**
	 * 是否删除
	 */

	private Boolean deleted;
	/**
	 * 错误消息
	 */

	private String errorMsg;
	/**
	 * 变更者ID
	 */

	private Long changerId;
	/**
	 * 稽核者ID
	 */

	private Long auditorId;
	/**
	 * 稽核状态
	 */

	private String auditStatus;
	/**
	 * 稽核时间
	 */
	@JsonSerialize(using = DateSerializer.class)
	@JsonDeserialize(using = DateDeserializer.class)
	private Date auditTime;
	/**
	 * 生效时间
	 */
	@JsonSerialize(using = DateSerializer.class)
	@JsonDeserialize(using = DateDeserializer.class)
	private Date effectiveTime;
	/**
	 * 失效时间
	 */
	@JsonSerialize(using = DateSerializer.class)
	@JsonDeserialize(using = DateDeserializer.class)
	private Date expiredTime;
	/**
	 * 回收站移出时间
	 */
	@JsonSerialize(using = DateSerializer.class)
	@JsonDeserialize(using = DateDeserializer.class)
	private Date moveOutTime;
	/**
	 * 资源信息{"name":"name","uuid":"uuid","code":"ecs"}
	 */

	private String resources;
	/**
	 * 规格信息
	 * {"skuId":1,"priceId":1,"count":1,"ratio":0.8,"serviceCode":"serviceCode","specs":{"cpu":1,"memory":1,"disk":100}}
	 */

	private String elements;
	/**
	 * 服务编码
	 */

	private String serviceCode;
	/**
	 * 配置信息
	 */

	private String inventory;
	/**
	 * 订单时间
	 */

	private Date orderTime;
	/**
	 * 服务名称
	 */

	private String serviceName;
	/**
	 * 规格详情
	 */

	private String elementNames;
	/**
	 * 规格详情
	 */

	private List<String> elementList;
	/**
	 * 折扣列表
	 */

	private List<String> discountList;

	private Long categoryId;


	private Long tenantId;

	private Long vendorId;
	// 系统盘类型

	private Long systemDiskCategoryId;

	/**
	 * 订单类别
	 *
	 * @author wangyu
	 * @version 1.0
	 * @since 2020年4月13日
	 */
	public enum Catalog {
		complex, // 复合
		single// 单一
	}

}
