package com.jeeplus.hotelorder.order.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jeeplus.core.domain.BaseEntity;
import com.jeeplus.core.query.Query;
import com.jeeplus.core.query.QueryType;
import lombok.Data;
import lombok.EqualsAndHashCode;

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

@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "hotel_order")
public class HotelOrder extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /** 订单号 */
    @Query(tableColumn = "a.order_no", type = QueryType.LIKE)
    private String orderNo;

    /** 房间号 */
    @Query(tableColumn = "a.room_no", type = QueryType.EQ)
    private String roomNo;

    /** 房间类型 */
    private String roomType;

    /** 联系人姓名 */
    @Query(tableColumn = "a.contact_name", type = QueryType.LIKE)
    private String contactName;

    /** 联系电话 */
    private String contactPhone;

    /** 订单状态 */
    @Query(tableColumn = "a.status", type = QueryType.EQ)
    private String status;

    /** 订单总金额 */
    private BigDecimal totalAmount;

    /** 配送费 */
    private BigDecimal deliveryFee;

    /** 支付方式 */
    private String payMethod;

    /** 配送时间类型(ASAP-立即送达, CUSTOM-自定义) */
    private String deliveryTimeType;

    /** 自定义配送时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date customDeliveryTime;

    /** 订单备注 */
    private String note;

    /** 接单时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date acceptTime;

    /** 出餐时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date readyTime;

    /** 配送时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date deliverTime;

    /** 完成时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date completeTime;

    /** 拒单原因 */
    private String rejectReason;

    /** 退单原因 */
    private String refundReason;

    /** 退单发起方(CUSTOMER/HOTEL_DESK) */
    private String refundInitiator;

    /** 退单时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date refundTime;

    /** 订单明细(非DB字段) */
    @TableField(exist = false)
    private List<HotelOrderItem> items;
}
