package io.hmit.modules.serviceOrder.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.hmit.common.constant.Constant;
import io.hmit.entity.UserEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.UUID;


/**
 * 订单表
 *
 * @author zsh 408538940@qq.com
 * @since 1.0.0 2021-01-26
 */
@Data
@ApiModel(value = "订单表")
public class PensionOrderDTO implements Serializable {
    private static final long serialVersionUID = 1L;

	@ApiModelProperty(value = "id")
	private Long id;

	@ApiModelProperty(value = "订单编号")
	private String orderNum;

	@ApiModelProperty(value = "订单状态")
	private Integer status;

	@ApiModelProperty(value = "订单状态名称")
	private String statusName;

	@ApiModelProperty(value = "详细地址")
	private String address;

	@ApiModelProperty(value = "定位坐标")
	private String location;

	@ApiModelProperty(value = "订单所属的服务id")
	private Long serviceId;

	@ApiModelProperty(value = "订单所属的服务名称")
	private String serviceName;

	@ApiModelProperty(value = "预约人")
	private String appointmentPerson;

	@ApiModelProperty(value = "预约人电话")
	private String appointmentPhone;

	@ApiModelProperty(value = "预约时间")
	private Date appointmentTime;

	@JsonInclude(JsonInclude.Include.NON_NULL)
	@ApiModelProperty(value = "取消原因")
	private String cancelReason;

	@ApiModelProperty(value = "备注")
	private String remark;

	@ApiModelProperty(value = "接单人id")
	private Long orderRecipientId;

	@ApiModelProperty(value = "接单人姓名")
	private String orderRecipientName;

	@ApiModelProperty(value = "接单时间")
	private Date orderRecipientTime;

	@ApiModelProperty(value = "接单人电话")
	private String orderRecipientPhone;

	@ApiModelProperty(value = "服务内容描述")
	private String content;

	@ApiModelProperty(value = "实际金额")
	private String actPrice;

	@ApiModelProperty(value = "部门ID")
	private Long deptId;

	@ApiModelProperty(value = "创建者")
	private Long creator;

	@ApiModelProperty(value = "订单发起人")
	private String creatorName;

	@ApiModelProperty(value = "订单发起人联系电话")
	private String creatorTel;

	@ApiModelProperty(value = "创建时间")
	private Date createDate;

	@ApiModelProperty(value = "更新者")
	private Long updater;

	@ApiModelProperty(value = "更新时间")
	private Date updateDate;

	@ApiModelProperty(value = "封面")
	private String icon;

	@ApiModelProperty(value = "所属社区名称")
	private String communityName;

	@ApiModelProperty(value = "所属社区Id")
	private Long communityId;

	@JsonInclude(JsonInclude.Include.NON_NULL)
	@ApiModelProperty(value = "用户评论照片")
	private List<PensionOrderDocumentDTO> userImages;

	@JsonInclude(JsonInclude.Include.NON_NULL)
	@ApiModelProperty(value = "服务人员评论照片")
	private List<PensionOrderDocumentDTO> staffImages;

	@JsonInclude(JsonInclude.Include.NON_NULL)
	@ApiModelProperty(value = "服务人员语音")
	private PensionOrderDocumentDTO staffVoiceMessage;

	@JsonInclude(JsonInclude.Include.NON_NULL)
	@ApiModelProperty(value = "订单评价信息")
	private PensionOrderEvaluationDTO pensionOrderEvaluationDTO;

	public PensionOrderDTO assemblePensionOrder(ReservationDTO reservationDTO, UserEntity user){
		PensionOrderDTO pensionOrder = new PensionOrderDTO();
		pensionOrder.setOrderNum("");
		pensionOrder.setStatus(Constant.OrderStatus.BOOKED.geStatus());
		pensionOrder.setStatusName(Constant.OrderStatus.BOOKED.getMessage());
		pensionOrder.setAddress(reservationDTO.getAddress());
		pensionOrder.setServiceId(reservationDTO.getServiceId());
		pensionOrder.setServiceName(reservationDTO.getServiceName());
		pensionOrder.setRemark(reservationDTO.getRemark());
		pensionOrder.setCreator(user.getId());
		pensionOrder.setCreatorName(user.getUsername());
		pensionOrder.setCreatorTel(user.getMobile());
		pensionOrder.setAppointmentPerson(reservationDTO.getAppointmentPerson());
		pensionOrder.setAppointmentPhone(reservationDTO.getAppointmentPhone());
		pensionOrder.setAppointmentTime(reservationDTO.getAppointmentTime());
		return pensionOrder;
	}


}
