package com.bocloud.cmp.model.common;

import com.bocloud.common.model.RequestContext;
import com.bocloud.nms.enums.OrderItemStatus;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

/**
 * 订单结果消息
 * 
 * @author wangyu
 * @version 1.0
 * @since 2020年4月14日
 *
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderMessage {

	// 旧子订单号
	private String sn;
	// 新订单号
	private String newSn;
	// 订单操作
	private Operation operation;
	// 子订单状态
	private OrderItemStatus status;
	// 延期时长
	private Integer extension;
	// 结果消息
	private String message;
	// 开通时间
	private Date effectiveTime;
	// 到期时间
	private Date expiredTime;
	// 资源列表,如果是扩容，则为增加的资源，否则为要删掉的资源
	private List<ResourceModel> resources;
	// 升级规格
	private List<ElementModel> upgrade;
	// 发送人
	private RequestContext context;
	// 配额信息
	private List<QuotaBean> quotas;
	// 资源类型
	private String category;

	/**
	 * 
	 * @param sn
	 * @param operation
	 * @param status
	 * @param extension
	 * @param message
	 * @param effectiveTime
	 * @param expiredTime
	 * @param resources
	 * @param category
	 * @param context
	 */
	public OrderMessage(String sn, Operation operation, OrderItemStatus status, Integer extension, String message,
			Date effectiveTime, Date expiredTime, List<ResourceModel> resources, String category,
			RequestContext context) {
		super();
		this.sn = sn;
		this.operation = operation;
		this.status = status;
		this.extension = extension;
		this.message = message;
		this.effectiveTime = effectiveTime;
		this.expiredTime = expiredTime;
		this.resources = resources;
		this.category = category;
		this.context = context;
	}

	public enum Operation {
		Application, // 服务申请
		Upgrade, // 升级
		ScaleIn, // 扩容
		ScaleOut, // 缩容
		Extension, // 服务延期
		Cancelation// 服务退订
	}
}
