package com.slodon.b2b2c.vo.member;

import com.slodon.b2b2c.core.constant.VideoConst;
import com.slodon.b2b2c.core.i18n.Language;
import com.slodon.b2b2c.core.util.CommonUtil;
import com.slodon.b2b2c.core.util.FileUrlUtil;
import com.slodon.b2b2c.core.util.TimeUtil;
import com.slodon.b2b2c.member.pojo.Member;
import com.slodon.b2b2c.member.pojo.MemberEnquiry;
import com.sun.org.apache.bcel.internal.generic.NEW;
import lombok.Data;
import org.springframework.util.StringUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * @author cyan
 */
@Data
public class OrderEnquiryVO implements Serializable {

    private static final long serialVersionUID = -8426680439937326616L;
    private Long id;

    private String webSite;

    private String name;

    private String email;

    private String phoneCode;

    private String phone;

    private Integer quantity;

    private String company;

    private String message;

    private String ip;

    private String country;

    private String region;

    private Date createTime;

    private String pageUrl;

    private String itemType;

    private Long itemId;

    private Long lastUid;

    private String lastUsername;

    private Date lastTime;

    private String status;

    private Long vendorId;

    private String vendorName;

    private String isDel;

    private Integer validStatus;

    private String validStatusStr;

    private String goodsName;

    private String storeName;

    private Long storeId;

    public OrderEnquiryVO(MemberEnquiry memberEnquiry) {
        id = memberEnquiry.getId();
        webSite = memberEnquiry.getWebSite();
        name = memberEnquiry.getName();
        email = memberEnquiry.getEmail();
        phoneCode = memberEnquiry.getPhoneCode();
        phone = memberEnquiry.getPhone();
        quantity = memberEnquiry.getQuantity();
        company = memberEnquiry.getCompany();
        message = memberEnquiry.getMessage();
        ip = memberEnquiry.getIp();
        country = memberEnquiry.getCountry();
        region = memberEnquiry.getRegion();
        createTime = memberEnquiry.getCreateTime();
        pageUrl = memberEnquiry.getPageUrl();
        itemType = getEnquiryTypeText(memberEnquiry.getItemType());
        itemId = memberEnquiry.getItemId();
        lastUid = memberEnquiry.getLastUid();
        lastUsername = memberEnquiry.getLastUsername();
        lastTime = memberEnquiry.getLastTime();
        status = getEnquiryStatusText(memberEnquiry.getStatus());
        vendorId = memberEnquiry.getVendorId();
        vendorName = memberEnquiry.getVendorName();
        isDel = memberEnquiry.getIsDel();
        validStatus = memberEnquiry.getValidStatus();
        validStatusStr = getEnquiryGarbageStatusText(memberEnquiry.getValidStatus());
        goodsName = memberEnquiry.getGoodsName();
        storeName = memberEnquiry.getStoreName();
        storeId = memberEnquiry.getStoreId();
    }

    /**
     * @param status
     * @return
     */
    public static String getEnquiryStatusText(String status) {
        String value = "";
        if (StringUtils.isEmpty(status)) {
            return null;
        }
        switch (status) {
            case "NEW":
                value = "新建";
                break;
            case "ASSIGN":
                value = "分配";
                break;
            case "REPLY":
                value = "回复";
                break;
            default:
                break;
        }
        return value;
    }

    /**
     * @param status
     * @return
     */
    public static String getEnquiryGarbageStatusText(Integer status) {
        String value = "";
        if (StringUtils.isEmpty(status)) {
            return null;
        }
        switch (status) {
            case 1:
                value = "无效";
                break;
            case 0:
                value = "有效";
                break;
            default:
                break;
        }
        return value;
    }

    /**
     * @param itemType
     * @return
     */
    public static String getEnquiryTypeText(String itemType) {
        String value = "";
        if (StringUtils.isEmpty(itemType)) {
            return null;
        }
        switch (itemType) {
            case "MALL":
                value = "平台";
                break;
            case "SHOP":
                value = "店铺";
                break;
            case "GOODS":
                value = "商品";
                break;
            default:
                break;
        }
        return value;
    }
}
