package com.datarecovery.master.data.api.bean;

import com.datarecovery.master.module.member.MemberType;
import com.datarecovery.master.utils.DateUtil;
import com.google.gson.annotations.SerializedName;

import java.util.Objects;

public class OrderBean {
    @SerializedName("itemName")
    private String itemName;
    @SerializedName("amount")
    private int amount;
    @SerializedName("outTradeNo")
    private String outTradeNo;
    @SerializedName("id")
    private int id;
    @SerializedName("authCode")
    private String authCode;

    @SerializedName("auths")
    private String auths;
    @SerializedName("startTimestamp")
    private long startTimestamp;
    @SerializedName("endTimestamp")
    private long endTimestamp;
    @SerializedName("permanent")
    private boolean permanent;

    @SerializedName("tutorialUrl")
    private String tutorialLink;

    public String getTutorialLink() {
        return tutorialLink;
    }

    public String getAuths() {
        return auths;
    }

    public String getExpireDate() {
        if (permanent) {
            return "永久有效";
        } else {
            return DateUtil.formatNormalDate(DateUtil.YYYY_MM_DD_HH_MM_SS, endTimestamp);
        }
    }

    public String getItemName() {
        return itemName;
    }

    public void setItemName(String itemName) {
        this.itemName = itemName;
    }

    public String getAmount() {
        return String.valueOf(amount / 100.0);
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getAuthCode() {
        return authCode;
    }

    public void setAuthCode(String authCode) {
        this.authCode = authCode;
    }

    public long getStartTimestamp() {
        return startTimestamp;
    }

    public void setStartTimestamp(long startTimestamp) {
        this.startTimestamp = startTimestamp;
    }

    public long getEndTimestamp() {
        return endTimestamp;
    }

    public void setEndTimestamp(long endTimestamp) {
        this.endTimestamp = endTimestamp;
    }

    public boolean isPermanent() {
        return permanent;
    }

    public void setPermanent(boolean permanent) {
        this.permanent = permanent;
    }

    public boolean isShowLink() {
        return Objects.equals(auths, MemberType.APP_WX_FRIEND_RECOVER) || Objects.equals(auths, MemberType.APP_WX_MESSAGE_RECOVER) || Objects.equals(auths, MemberType.APP_SUPER_RECOVER);
    }
}
