package com.gxwebsoft.glt.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

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

/**
 * 送水订单
 *
 * @author 科技小王子
 * @since 2026-02-05 18:50:20
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Schema(name = "GltTicketOrder对象", description = "送水订单")
@TableName("glt_ticket_order")
public class GltTicketOrder implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @Schema(description = "订单编号")
    private String no;

    @Schema(description = "用户水票ID")
    private Integer userTicketId;

    @Schema(description = "关联订单编号")
    @TableField(exist = false)
    private String orderNo;

    @Schema(description = "订单状态")
    @TableField(exist = false)
    private Integer orderStatus;

    @Schema(description = "门店ID")
    private Integer storeId;

    @Schema(description = "门店名称")
    @TableField(exist = false)
    private String storeName;

    @Schema(description = "门店地址")
    @TableField(exist = false)
    private String storeAddress;

    @Schema(description = "门店手机号")
    @TableField(exist = false)
    private String storePhone;

    @Schema(description = "配送员")
    private Integer riderId;

    @Schema(description = "配送员名称")
    @TableField(exist = false)
    private String riderName;

    @Schema(description = "配送员手机号")
    @TableField(exist = false)
    private String riderPhone;

    @Schema(description = "仓库ID")
    private Integer warehouseId;

    @Schema(description = "仓库名称")
    @TableField(exist = false)
    private String warehouseName;

    @Schema(description = "仓库地址")
    @TableField(exist = false)
    private String warehouseAddress;

    @Schema(description = "仓库手机号")
    @TableField(exist = false)
    private String warehousePhone;

    @Schema(description = "关联收货地址")
    private Integer addressId;

    @Schema(description = "收货地址")
    private String address;

    @Schema(description = "省")
    @TableField(exist = false)
    private String province;

    @Schema(description = "市")
    @TableField(exist = false)
    private String city;

    @Schema(description = "区")
    @TableField(exist = false)
    private String region;

    @Schema(description = "买家留言")
    private String buyerRemarks;

    @Schema(description = "用于统计")
    private BigDecimal price;

    @Schema(description = "购买数量")
    private Integer totalNum;

    @Schema(description = "配送时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String sendTime;

    @Schema(description = "配送状态：10待配送、20配送中、30待客户确认、40已完成")
    private Integer deliveryStatus;

    @Schema(description = "开始配送时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime sendStartTime;

    @Schema(description = "确认送达时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime sendEndTime;

    @Schema(description = "送达拍照留档图片URL")
    private String sendEndImg;

    @Schema(description = "客户确认收货时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime receiveConfirmTime;

    @Schema(description = "确认方式：10客户手动确认、20配送照片自动确认、30超时自动确认")
    private Integer receiveConfirmType;

    @Schema(description = "用户ID")
    private Integer userId;

    @Schema(description = "昵称")
    @TableField(exist = false)
    private String nickname;

    @Schema(description = "手机号")
    @TableField(exist = false)
    private String phone;

    @Schema(description = "头像")
    @TableField(exist = false)
    private String avatar;

    @Schema(description = "收货人姓名")
    @TableField(exist = false)
    private String receiverName;

    @Schema(description = "收货人手机号")
    @TableField(exist = false)
    private String receiverPhone;

    @Schema(description = "收货省")
    @TableField(exist = false)
    private String receiverProvince;

    @Schema(description = "收货市")
    @TableField(exist = false)
    private String receiverCity;

    @Schema(description = "收货区")
    @TableField(exist = false)
    private String receiverRegion;

    @Schema(description = "收货详细地址")
    @TableField(exist = false)
    private String receiverAddress;

    @Schema(description = "收货完整地址")
    @TableField(exist = false)
    private String receiverFullAddress;

    @Schema(description = "收货纬度")
    @TableField(exist = false)
    private String receiverLat;

    @Schema(description = "收货经度")
    @TableField(exist = false)
    private String receiverLng;

    @Schema(description = "门店经纬度(lng,lat)")
    @TableField(exist = false)
    private String storeLngAndLat;

    @Schema(description = "仓库经纬度(lng,lat)")
    @TableField(exist = false)
    private String warehouseLngAndLat;

    @Schema(description = "配送方式：elevator(电梯) / stairs(步梯) / groundFloor(一楼商铺/其他)")
    private String deliveryMethod;

    @Schema(description = "楼层（步梯+送上楼时有值，从2开始）")
    private Integer deliveryFloor;

    @Schema(description = "详细地址")
    @TableField(exist = false)
    private String fullAddress;

    @Schema(description = "配送费（步梯+送上楼时计算：数量 × (楼层-1)）")
    private BigDecimal deliveryFee;

    @Schema(description = "排序(数字越小越靠前)")
    private Integer sortNumber;

    @Schema(description = "备注")
    private String comments;

    @Schema(description = "状态, 0正常, 1冻结")
    private Integer status;

    @Schema(description = "是否删除, 0否, 1是")
    @TableLogic
    private Integer deleted;

    @Schema(description = "租户id")
    private Integer tenantId;

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @Schema(description = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

}
