package com.yc.ship.module.trade.controller.admin.order.vo.order;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yc.ship.framework.excel.core.annotations.DictFormat;
import com.yc.ship.framework.excel.core.convert.DictConvert;
import com.yc.ship.module.member.api.address.dto.MemberAddressRespDTO;
import com.yc.ship.module.product.api.dto.ProductSaleRuleRespDTO;
import com.yc.ship.module.trade.api.dto.TradeOrderPayDTO;
import com.yc.ship.module.trade.controller.admin.order.vo.market.MarketingRespVO;
import com.yc.ship.module.trade.controller.admin.order.vo.market.RuleSpecNum;
import com.yc.ship.module.product.api.dto.ProductSpuRespDTO;
import com.yc.ship.module.trade.dal.dataobject.contract.ContractDO;
import com.yc.ship.module.trade.dal.dataobject.insurance.InsuranceDO;
import com.yc.ship.module.trade.dal.dataobject.order.TradeOrderDeliveryVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

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

import static com.yc.ship.framework.common.util.date.DateUtils.*;


@Schema(description = "管理后台 - 交易订单 Response VO")
@Data
@ExcelIgnoreUnannotated
public class TradeOrderPdaRespVO {

    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "10096")
    private Long id;

    @Schema(description = "订单号")
    @ExcelProperty("订单号")
    private String orderNo;

    @Schema(description = "申请政策ID")
    private Long marketingAuditId;

    @Schema(description = "第三方流水号")
//    @ExcelProperty("第三方流水号")
    private String externalOrderNo;

    @Schema(description = "第三方原始订单号")
    @ExcelProperty("第三方原始订单号")
    private String externalOriginOrderNo;

    @Schema(description = "第三方订单号")
    private String sourceOrderNo;

    @Schema(description = "时间方案id", example = "12322")
    private Long routePlanId;

    @Schema(description = "时间方案", example = "12322")
    @ExcelProperty("时间方案")
    private String routePlanName;

    @Schema(description = "销售方式")
    @ExcelProperty(value = "销售方式", converter = DictConvert.class)
    @DictFormat("sale_channel_all")
    private Integer sellMethod;

    @Schema(description = "销售方式名称")
    private String sellMethodName;

    @Schema(description = "游客类型;0散客 1团队")
    private Integer visitorType;

    @Schema(description = "预约游玩日期")
    @ExcelProperty("出行日期")
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY, timezone = TIME_ZONE_DEFAULT)
    private LocalDateTime travelDate;

    @Schema(description = "会员ID")
    private String memberId;

    @Schema(description = "销售来源", example = "31758")
    private String sourceId;

    @Schema(description = "来源名称", example = "张三")
    @ExcelProperty("来源名称")
    private String sourceName;

    @Schema(description = "销售员ID", example = "23415")
    private String sellerId;

    @Schema(description = "销售员姓名", example = "测试")
    @ExcelProperty("操作员")
    private String sellerName;

    @Schema(description = "销售员手机号", example = "测试")
//    @ExcelProperty("销售员手机号")
    private String sellerMobile;

    @Schema(description = "业务员姓名", example = "测试")
    @ExcelProperty("业务员姓名")
    private String businessName;

    @Schema(description = "订单金额")
    @ExcelProperty("应收金额")
    private BigDecimal amount;

    @Schema(description = "业绩共享员")
    @ExcelProperty("业绩共享员")
    private String shareName;

    @Schema(description = "支付金额")
    @ExcelProperty("实收金额")
    private BigDecimal payAmount;

    @Schema(description = "手续费金额")
    @ExcelProperty("手续费金额")
    private BigDecimal feeAmount;

    @Schema(description = "退款金额")
    @ExcelProperty("退款金额")
    private BigDecimal refundAmount;

    @Schema(description = "结算金额")
    @ExcelProperty("结算金额")
    private BigDecimal realAmount;

    @Schema(description = "补票金额")
    @ExcelProperty("补票金额")
    private BigDecimal suppAmount;

    @Schema(description = "B端结算价")
    @ExcelProperty("B端结算价")
    private BigDecimal platAmount;

    @Schema(description = "订单状态", example = "2")
    @ExcelProperty(value = "订单状态", converter = DictConvert.class)
    @DictFormat("trade_order_status")
    private Integer orderStatus;

    @Schema(description = "订单状态", example = "2")
    private String orderStatusName;

    @Schema(description = "支付状态", example = "2")
//    @ExcelProperty(value = "支付状态", converter = DictConvert.class)
    @DictFormat("payment_status")
    private Integer paymentStatus;

    @Schema(description = "支付状态", example = "2")
    private Integer paymentStatusName;

    @Schema(description = "支付方式", example = "2")
    @ExcelProperty(value = "支付方式", converter = DictConvert.class)
    @DictFormat("payment_type")
    private Integer paymentType;

    @Schema(description = "支付方式", example = "2")
    private String paymentTypeName;

    @Schema(description = "支付时间")
//    @ExcelProperty("支付时间")
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
    private LocalDateTime paymentDate;

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

    @Schema(description = "营销政策备注")
//    @ExcelProperty("营销政策备注")
    private String auditRemark;


    @Schema(description = "创建时间")
    @ExcelProperty("创建时间")
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
    private LocalDateTime createTime;

    @Schema(description = "票种张数")
//    @ExcelProperty("总票数")
    private int totalNum;

    @Schema(description = "票种张数")
    @ExcelProperty("总票数")
    private int num;

    @Schema(description = "实际票种张数（不包含退票）")
    @ExcelProperty("总票数")
    private int realnum;

    @Schema(description = "通用规格数量")
    private int commonNum;

    @Schema(description = "全价规格数量")
    private int  fullNum;

    @Schema(description = "半价规格数量")
    private int halfNum;

    @Schema(description = "免票规格数量")
    private int freeNum;

    @Schema(description = "车位规格数量")
    private int carSeatNum;

    @Schema(description = "优待票规格数量")
    private int carYdNum;

    @Schema(description = "其他规格数量")
    private int otherNum;

    @Schema(description = "携童票规格数量")
    private int carryingChildrenNum;

    @Schema(description = "各规格票数")
//    @ExcelProperty("规格票数")
    private String specNumber;

    @Schema(description = "联系人姓名")
    @ExcelProperty("联系人姓名")
    private String contactName;

    @Schema(description = "证件号")
    private String credentialNo;
    @Schema(description = "城市")
    private String city;
    @Schema(description = "省")
    private String province;
    @Schema(description = "区")
    private String county;

    @Schema(description = "手机号")
    @ExcelProperty("手机号")
    private String mobile;

    @Schema(description = "产品名称")
    @ExcelProperty("产品名称")
    private String productName;

    @Schema(description = "是否增加订单 0 否 1是", example = "")
    private Integer isAddOrder;

    @Schema(description = "财务标签")
    @ExcelProperty(value ="财务标签",converter = DictConvert.class)
    @DictFormat("product_tag")
    private int productTag;

    @Schema(description = "运营标签")
    @ExcelProperty(value ="运营标签",converter = DictConvert.class)
    @DictFormat("product_tag2")
    private int productTag2;

    @Schema(description = "业务标签")
    @ExcelProperty(value ="业务标签",converter = DictConvert.class)
    @DictFormat("product_tag3")
    private int productTag3;

    @Schema(description = "标签4")
    @ExcelProperty(value ="标签4",converter = DictConvert.class)
    @DictFormat("product_tag4")
    private int productTag4;

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

    @Schema(description = "门店名称")
    @ExcelProperty("门店名称")
    private String storeName;

//    @Schema(description = "转交分销商的分销商ID")
//    private String transDistributorId;

//    @Schema(description = "转交分销商的分销商名字")
//    @ExcelProperty("转交分销商的分销商名字")
//    private String transDistributorName;
//
//    @Schema(description = "转交金额")
//    @ExcelProperty("转交金额")
//    private String transAmount;

    @Schema(description = "绑定ID")
    private Long bindId;

    @Schema(description = "区域经理id")
    private Long areaManagerId;

    @Schema(description = "主团社ID")
    private Long agencyGroupId;

    @Schema(description = "主团社名称")
    @ExcelProperty("主团社")
    private String agencyGroupName;

    @Schema(description = "区域经理名字")
    private String areaManagerName;

    @Schema(description = "营销政策申请审核状态")
    private Integer auditState;

    @Schema(description = "营销政策使用请审核状态")
    private Integer useAuditState;

    @Schema(description = "附件")
    private String fileUrl;


    @Schema(description = "是否申请营销政策（0否 1是）")
    private Integer isMarketing;

    @Schema(description = "是否申请使用营销政策（0否 1是）")
    private Integer isMarketingUse;

    @Schema(description = "营销政策审核类型")
    private Integer auditType;

    @Schema(description = "营销政策类型")
    private Integer policyType;

    @Schema(description = "营销政策名称")
    @ExcelProperty("政策名称")
    private String marketingName;

    @Schema(description = "使用张数")
    private String marketingTypeNum;

    @Schema(description = "是否执行政策")
    private Integer isExecute;

    @Schema(description = "执行失败原因")
    private String errorText;

    @Schema(description = "关联标识 0主订单 1被关联订单")
//    @ExcelProperty("关联标识 0主订单 1被关联订单")
    private Integer isBind;

    @Schema(description = "计调状态 0待出票 1部分出票 2全部出票")
    private Integer dispatchStatus;

    @Schema(description = "开票标识:0-未开票，1-开票成功，2-开票失败，3-已开票")
    private Integer isInvoice;

    @Schema(description = "发票下载")
    private String invoiceUrl;

    @Schema(description = "当前站点可检门票")
    private Integer thisSiteCanCheckNum;

    @Schema(description = "成本价")
    private BigDecimal costPrice;

    @Schema(description = "是否已评论")
    private Integer isComment;

    @Schema(description = "营销政策")
    private List<MarketingRespVO> marketingList;

    @Schema(description = "可用营销政策")
    private  List<RuleSpecNum> marketingUseList;

    @Schema(description = "订单产品规格")
    private List<ProductSpuRespDTO> productSpuList;

    @Schema(description = "支付信息")
    private List<TradeOrderPayDTO> orderPayList;

    @Schema(description = "保险")
    private List<InsuranceDO> insuranceList;

    @Schema(description = "合同")
    private List<ContractDO> contractList;

    @Schema(description = "门票信息")
    private List<TradeDetailRespVO> tradeDetailList;

    @Schema(description = "售票规则")
    private ProductSaleRuleRespDTO saleRule;

    @Schema(description = "订单操作信息")
    private List<TradeOrderLogRespVO> tradeOrderLogList;

    @Schema(description = "优惠劵ID")
    private String couponId;

    @Schema(description = "优惠劵名称")
    private String couponName;

    @Schema(description = "是否为定向库存订单 1是")
    private Integer isDirect;

    @Schema(description = "改签订单标识 0老订单 1新订单")
    private Integer isChangeOrder;

    @Schema(description = "非实名票数")
    @ExcelProperty("未实名票数")
    private Integer notRealNum;

    @Schema(description = "团号")
    @ExcelProperty("团号")
    private String groupNo;

    @Schema(description = "平台端，优惠金额")
    @ExcelProperty("优惠金额")
    private BigDecimal saleAmount;

    @Schema(description = "小程序子产品ID")
    private Long packProductId;

    @Schema(description = "是否需要审核")
    @ExcelProperty("订单审核状态")
    private Integer confirmType;

    @Schema(description = "出行状态")
    @ExcelProperty("出行状态")
    @DictFormat("travel_status")
    private Integer travelStatus;

    @Schema(description = "完结状态")
    @ExcelProperty("完结状态")
    @DictFormat("trade_finish_status")
    private Integer finishStatus;


    @Schema(description = "订单交付信息")
    private TradeOrderDeliveryVO tradeOrderDelivery;

    @Schema(description = "邮寄地址")
    private MemberAddressRespDTO memberAddress;

    @Schema(description = "酒店预定信息")
    private List<TradeHotelBookingRespVO> hotelBookingList;

    @Schema(description = "是否审阅（0否 1是）")
    private Integer isRead;

    @Schema(description = "审阅人")
    private Long readUser;

    @Schema(description = "审阅人名称")
    private String readUserName;

    @Schema(description = "审阅时间")
    private LocalDateTime readTime;

    @Schema(description = "定金")
    private BigDecimal deposi;

    @Schema(description = "实付已经金额")
    private BigDecimal realPayAmount;

    @Schema(description = "政策优惠金额")
    private BigDecimal freeAmount;

    @Schema(description = "是否需要补缴费 1是 0 否")
    private Integer isSupplementary;

    @Schema(description = "受损金额")
    private BigDecimal damaged;

    @Schema(description = "补缴费金额")
    private BigDecimal  supplementAmount;

    @Schema(description = "取消状态 0：初始 1：已提交取消 2：取消成功")
    private Integer damagedStatus;

    @Schema(description = "取消提交时间")
    private LocalDateTime damagedTime;

    @Schema(description = "定金支付状态")
    private Integer deposiStatus;


    @Schema(description = "定金支付时间")
    private LocalDateTime deposiPayTime;

    @Schema(description = "排序")
    private Integer orderSort;

}
