package com.adealink.weparty.module.order.data

import com.google.gson.annotations.GsonNullable
import com.google.gson.annotations.SerializedName

/**
 *
 */
enum class OrderStatus(val status: Int) {
    CREATE_ORDER(0), //创建订单(订单初始状态)
    WAIT_FOR_ACCEPT(1), //等待接单

    PLAYMATE_ACCEPT(4), //接单
    PLAYMATE_IN_SERVICE(6), //服务中
    PLAYMATE_END_SERVICE(7), //服务完成(陪玩触发)

    PLAYMATE_REFUSE(5), //拒绝
    COMPLETE(2), //订单完成
    USER_REFUND(3), //退款
    USER_CANCEL(8); //用户取消订单

    companion object {
        @JvmStatic
        fun map(status: Int?): OrderStatus? {
            status ?: return null
            return entries.find { it.status == status }
        }
    }
}

data class PlaymateOrderDetailData(
    @SerializedName("orderInfo") val orderInfo: PlaymateOrderData, //付费订单信息

    @GsonNullable
    @SerializedName("reason") val clientReason: String?, //客户理由
    @GsonNullable
    @SerializedName("attachments") val clientAttachments: List<PlaymateOrderAttachment>?, //客户附件
    @GsonNullable
    @SerializedName("playmateReason") val playmateReason: String?, //陪玩理由
    @GsonNullable
    @SerializedName("playmateAttachments") val playmateAttachments: List<PlaymateOrderAttachment>?, //陪玩附件
)

data class PlaymateOrderData(
    @SerializedName("orderId") val orderId: String, //订单ID
    @SerializedName("bizCategoryName") val categoryName: String, //品类名称
    @SerializedName("categoryIcon") var categoryIcon: String, //品类图标
    @SerializedName("price") var price: Float, //单价
    @SerializedName("unit") var unit: String, //价格单位
    @SerializedName("purchaseQty") var purchaseQty: String, //购买数量
    @SerializedName("status") var status: String, //订单状态
    @SerializedName("createTime") var createTime: String, //下单时间(时间戳, 毫秒)

    @SerializedName("avatar") var avatar: String, //头像
    @SerializedName("nickname") var nickname: String, //昵称
    @SerializedName("gender") var gender: Int, //性别


    @GsonNullable
    @SerializedName("star") var star: Int?, //评分
    @GsonNullable
    @SerializedName("refundApply") var refundApply: Boolean?, //是否退款申请中
    @GsonNullable
    @SerializedName("customerRemark") var customerRemark: String?, //客户备注
)

data class PlaymateOrderAttachment(
    @SerializedName("attachmentUrl") val attachmentUrl: String,
    @SerializedName("type") val type: String,
    @SerializedName("fileName") val fileName: String,
)

