package shop.alien.store.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import shop.alien.entity.store.StoreBookingSettings;
import shop.alien.entity.store.UserReservationOrder;
import shop.alien.entity.store.vo.StoreInfoVo;
import shop.alien.entity.store.vo.UserReservationVo;

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

/**
 * 按订单ID查询的详情：订单 + 门店信息 + 预订设置 + 预订信息 + 定桌信息 + 页面展示字段（与 /store/reservationOrder/page 一致）
 *
 * @author system
 */
@Data
@ApiModel(value = "ReservationOrderDetailVo", description = "预订订单详情（订单+门店+预订设置+预订+定桌+页面展示）")
public class ReservationOrderDetailVo {

    @ApiModelProperty(value = "预订订单（user_reservation_order）")
    private UserReservationOrder order;

    @ApiModelProperty(value = "门店信息（含 distance、distance2、subwayName、storeLocation）")
    private StoreInfoVo storeInfo;

    @ApiModelProperty(value = "门店预订设置（store_booking_settings）")
    private StoreBookingSettings storeBookingSettings;

    @ApiModelProperty(value = "预订/预约信息")
    private UserReservationVo reservation;

    @ApiModelProperty(value = "定桌信息（桌号、区域等）")
    private List<BookingTableItemVo> tableList;

    // --------- 以下为页面展示字段（与 ReservationOrderPageVo 一致，供前端订单详情/待支付/预订成功等页统一使用） ---------

    @ApiModelProperty(value = "订单ID")
    private Integer orderId;
    @ApiModelProperty(value = "订单编号")
    private String orderSn;
    @ApiModelProperty(value = "订单状态 0:待支付 1:待使用 2:已完成 3:已过期 4:已取消 5:已关闭 6:退款中 7:已退款 8:商家预订")
    private Integer orderStatus;
    @ApiModelProperty(value = "支付状态 0:未支付 1:已支付 2:已退款")
    private Integer paymentStatus;
    @ApiModelProperty(value = "页面主标题：待支付/预订成功/待使用/已完成/已过期/已取消/已关闭/退款中")
    private String pageTitle;
    @ApiModelProperty(value = "页面标题后缀：免费预订/不可免责取消/分情况是否免责")
    private String pageTitleSuffix;
    @ApiModelProperty(value = "状态副标题")
    private String statusSubtitle;

    @ApiModelProperty(value = "支付截止时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date paymentDeadline;
    @ApiModelProperty(value = "剩余支付秒数")
    private Integer paymentSecondsLeft;
    @ApiModelProperty(value = "待支付有效时长（分钟）")
    private Integer paymentDeadlineMinutes;

    @ApiModelProperty(value = "门店ID")
    private Integer storeId;
    @ApiModelProperty(value = "门店名称")
    private String storeName;
    @ApiModelProperty(value = "门店地址")
    private String storeAddress;
    @ApiModelProperty(value = "门店电话")
    private String storeTel;
    @ApiModelProperty(value = "门店坐标（经度,纬度）")
    private String storePosition;

    @ApiModelProperty(value = "就餐日期 yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date reservationDate;
    @ApiModelProperty(value = "就餐日期展示 如 02月02日 今天")
    private String reservationDateText;
    @ApiModelProperty(value = "人数/桌型描述 如 包间6人")
    private String guestAndCategoryText;
    @ApiModelProperty(value = "桌号列表 如 A01,A02")
    private String tableNumbersText;
    @ApiModelProperty(value = "就餐时间段 如 10:00-12:03")
    private String diningTimeSlotText;

    @ApiModelProperty(value = "核销码")
    private String verificationCode;
    @ApiModelProperty(value = "核销二维码内容或URL")
    private String verificationUrl;

    @ApiModelProperty(value = "未按时到店座位保留时长（分钟）")
    private Integer lateArrivalGraceMinutes;
    @ApiModelProperty(value = "座位保留说明")
    private String seatRetentionText;
    @ApiModelProperty(value = "订金金额（元）")
    private BigDecimal depositAmount;
    @ApiModelProperty(value = "订金说明 如 需支付¥50订金")
    private String depositText;
    @ApiModelProperty(value = "订金退还规则描述")
    private String depositRefundRule;
    @ApiModelProperty(value = "取消政策类型 0:免费预订 1:不可免费取消 2:分情况免责")
    private Integer cancellationPolicyType;
    @ApiModelProperty(value = "免费取消截止时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date freeCancellationDeadline;
    @ApiModelProperty(value = "免费取消截止展示 如 12月31日 09:00前可免责取消")
    private String freeCancellationDeadlineText;
    @ApiModelProperty(value = "取消政策说明文案")
    private String cancellationPolicyText;

    @ApiModelProperty(value = "预订/下单时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date orderCreatedTime;
    @ApiModelProperty(value = "预订时间展示 如 01月01日 今天")
    private String orderCreatedTimeText;
    @ApiModelProperty(value = "预约人数")
    private Integer guestCount;
    @ApiModelProperty(value = "位置桌型 如 大厅|A01,A02")
    private String locationTableText;
    @ApiModelProperty(value = "就餐时间 如 10:00-12:00")
    private String diningTimeText;
    @ApiModelProperty(value = "联系人姓名")
    private String contactName;
    @ApiModelProperty(value = "联系人电话")
    private String contactPhone;
    @ApiModelProperty(value = "联系方式展示 如 张三 13847859088")
    private String contactText;

    @ApiModelProperty(value = "订金金额，用于「¥50 继续支付」按钮")
    private BigDecimal payAmount;
    @ApiModelProperty(value = "是否可继续支付（待支付且未超时）")
    private Boolean canContinuePay;
    @ApiModelProperty(value = "是否显示「取消预订」按钮")
    private Boolean canCancelReservation;
    @ApiModelProperty(value = "是否显示「修改预订」按钮")
    private Boolean canModifyReservation;
    @ApiModelProperty(value = "是否显示「删除」按钮")
    private Boolean canDelete;
    @ApiModelProperty(value = "是否显示「再次预订」按钮")
    private Boolean canBookAgain;
    @ApiModelProperty(value = "当前待支付对应的商户订单号 outTradeNo，用于轮询 queryStatus")
    private String outTradeNo;

    @ApiModelProperty(value = "退款类型（与 user_reservation_order.refund_type 一致）")
    private Integer refundType;

    @ApiModelProperty(value = "商家取消原因（user_reservation.reason，商家取消时有值）")
    private String merchantCancelReason;
}
