package com.ylx.order.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ylx.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 订单实体类
 * <p>
 * 对应数据库表 t_order，用于存储按摩服务订单的完整信息。
 * 包含订单基本信息、服务项目信息、用户信息、技师信息、支付信息、
 * 状态流转信息等多个维度的业务数据。
 * <p>
 * 订单状态流转：
 * -1(待付款) → 0(待接单) → 1(已接单) → 6(已出发) → 2(已到达) → 3(服务中) → 4(待评价) → 5(已完成)
 * 特殊状态：-2(已取消)、-3(已拒绝)
 * </p>
 *
 * @author YJR
 * @version 1.0
 * @since 2023-12-30
 */
@Data
@Accessors(chain = true)
@TableName(value = "t_order", autoResultMap = true)
@ApiModel(value = "TOrder", description = "订单实体类")
public class TOrder extends BaseEntity {

    private static final long serialVersionUID = -5178393451245876888L;

    @ApiModelProperty("主键ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty("订单号")
    private String orderNo;

    @ApiModelProperty("用户ID")
    private Long userId;

    @ApiModelProperty("商户ID")
    private Long merchantId;

    @ApiModelProperty("商户类型（0：真实商户 1：虚拟商户）")
    private Integer merchantType;

    @ApiModelProperty("商户昵称")
    private String merchantNickName;

    @ApiModelProperty("商户头像")
    private String merchantAvatar;

    @ApiModelProperty("项目ID")
    private Long projectId;

    @ApiModelProperty("项目类型：1=按摩 2=陪玩")
    private Integer projectType;

    @ApiModelProperty("项目名称")
    private String projectName;

    @ApiModelProperty("项目封面图")
    private String projectCover;

    @ApiModelProperty("预约开始时间")
    private LocalDateTime appointmentStartTime;

    @ApiModelProperty("项目时长（分钟）")
    private Integer projectDuration;

    @ApiModelProperty("项目亮点")
    private String highlight;

    @ApiModelProperty("联系人姓名")
    private String contactPersonName;

    @ApiModelProperty("联系人电话号码")
    private String contactPhoneNumber;

    @ApiModelProperty("详细服务地址")
    private String contactAddressInfo;

    @ApiModelProperty("项目标价/售价")
    private BigDecimal basePrice;

    @ApiModelProperty("优惠券抵扣金额")
    private BigDecimal couponDiscount;

    @ApiModelProperty("交通费")
    private BigDecimal trafficFee;

    @ApiModelProperty("最终应付/实付金额 = base_price - coupon_discoun + traffic_fee")
    private BigDecimal finalAmount;

    @ApiModelProperty("付款方式：0=购物卡，1=微信支付")
    private Integer paymentMethod;

    @ApiModelProperty("派单时间")
    private LocalDateTime dispatchedTime;

    @ApiModelProperty("支付完成时间")
    private LocalDateTime paidTime;

    @ApiModelProperty("商户确认/接单时间")
    private LocalDateTime confirmedTime;

    @ApiModelProperty("商户出发时间")
    private LocalDateTime departedTime;

    @ApiModelProperty("商户到达时间")
    private LocalDateTime arrivedTime;

    @ApiModelProperty("商户签到时间")
    private LocalDateTime signTime;

    @ApiModelProperty("服务开始时间")
    private LocalDateTime startTime;

    @ApiModelProperty("服务完成时间")
    private LocalDateTime completedTime;

    @ApiModelProperty("订单取消时间")
    private LocalDateTime cancelledTime;

    @ApiModelProperty("退款时间")
    private LocalDateTime refundedTime;

    @ApiModelProperty("发起售后时间")
    private LocalDateTime afterSalesTime;

    @ApiModelProperty("拒绝接单时间")
    private LocalDateTime rejectedTime;

    @ApiModelProperty("删除时间")
    private LocalDateTime deletedTime;

    @ApiModelProperty("订单状态：0=待付款，1=待派单，2=待接单，3=待服务，4=服务中，5=售后中，6=已完成，7=已退款，8=已取消，9=已关闭，10=拒绝接单")
    private Integer status;

    @ApiModelProperty("履约状态：0=待出发/待签到，1=已出发，2=已到达/已签到")
    private Integer execStatus;

    @ApiModelProperty("拒接原因")
    private String rejectedReason;

    @ApiModelProperty("取消原因")
    private String cancelledReason;

    @ApiModelProperty("到达照片")
    private String arrivalPhoto;

    @ApiModelProperty("开始服务照片")
    private String startPhoto;

    @ApiModelProperty("用户下单时纬度")
    private BigDecimal userLatitude;

    @ApiModelProperty("用户下单时经度")
    private BigDecimal userLongitude;

    @ApiModelProperty("商户真实纬度")
    private BigDecimal merchantLatitude;

    @ApiModelProperty("商户真实经度")
    private BigDecimal merchantLongitude;

    @ApiModelProperty("商户虚拟地址纬度")
    private BigDecimal virtualLatitude;

    @ApiModelProperty("商户虚拟地址经度")
    private BigDecimal virtualLongitude;

    @ApiModelProperty("是否删除 0否 1是")
    private Integer isDelete;

    @ApiModelProperty("派单情况：0=未派单 1=已派单")
    private Integer dispatchedStatus;

    @ApiModelProperty("优惠券id")
    private String couponId;

    @ApiModelProperty("预约结束时间")
    private LocalDateTime appointmentEndTime;

    @ApiModelProperty("平台收益")
    private BigDecimal platformIncome;

    @ApiModelProperty("商户收益")
    private BigDecimal merchantIncome;

    @ApiModelProperty("用户下单地址的城市区域码")
    private String cityCode;
}
