package com.sheep.gamegroup.model.entity;//

import android.text.TextUtils;

import com.sheep.gamegroup.util.LogUtil;
import com.sheep.gamegroup.util.TimeUtil;

import java.util.Calendar;
import java.util.Locale;

/**
 * 充值记录
 * Created by ljy on 2018/6/27.
 */

public class RechargeLogEntity implements ILog {
    private int From1;//	integer($int64)1:完成任务 2提现审核不通过退钱 3微信挂机赚钱　4下级完成任务提成 5贷款　6注册奖励　7旧版同步过来的　8第三方充值 9新手任务 10Q币充值失败退钱11：提现 12游戏充值 13 购买APP Store充值卡 14 充值Q币 15打卡报名 16实名认证费用 17游戏消费 18扣除游戏抵扣券 19代理代充 21打卡奖励 22代理提成 23增加游戏抵扣券

    private String Status;//	string
    private String Title;//	string
    private double amount;//	number($double)金额

    private int create_time;//integer($int64)记录时间

    private String detail_desc;//	string明细描述

    private int id;//	integer($int64)
    private int relate_user;//	integer($int64)关联用户id

    private int release_task_id;//	integer($int64)已发布任务id

    private double surplus_amount;//	number($double)剩余金额

    private int type;//	integer($int64)1:进钱 2出钱

    private int user_id;//integer($int64)用户id

    private String wx_account;//string微信账
    private boolean isSelect;

    public boolean isSelect() {
        return isSelect;
    }

    public void setSelect(boolean select) {
        isSelect = select;
    }

    public int getFrom1() {
        return From1;
    }

    public void setFrom1(int from1) {
        From1 = from1;
    }

    public String getStatus() {
        return Status;
    }

    public void setStatus(String status) {
        Status = status;
    }

    public String getTitle() {
        return Title;
    }

    public void setTitle(String title) {
        Title = title;
    }

    public double getAmount() {
        return amount;
    }

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

    public int getCreate_time() {
        return create_time;
    }

    public void setCreate_time(int create_time) {
        this.create_time = create_time;
    }

    public String getDetail_desc() {
        return detail_desc;
    }

    public void setDetail_desc(String detail_desc) {
        this.detail_desc = detail_desc;
    }

    public int getId() {
        return id;
    }

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

    public int getRelate_user() {
        return relate_user;
    }

    public void setRelate_user(int relate_user) {
        this.relate_user = relate_user;
    }

    public int getRelease_task_id() {
        return release_task_id;
    }

    public void setRelease_task_id(int release_task_id) {
        this.release_task_id = release_task_id;
    }

    public double getSurplus_amount() {
        return surplus_amount;
    }

    public void setSurplus_amount(double surplus_amount) {
        this.surplus_amount = surplus_amount;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getUser_id() {
        return user_id;
    }

    public void setUser_id(int user_id) {
        this.user_id = user_id;
    }

    public String getWx_account() {
        return wx_account;
    }

    public void setWx_account(String wx_account) {
        this.wx_account = wx_account;
    }

    @Override
    public String getStateText() {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append(type== 1?"+ ":"- ");
        stringBuffer.append(String.format(Locale.CHINA,"%.2f元", amount));
        return stringBuffer.toString()+"";
    }

    @Override
    public String getEventText() {
        return detail_desc;
    }

    @Override
    public boolean isEventSuccess() {
        return type== 1;
    }

    @Override
    public long getEventTime() {
        return create_time;
    }


    @Override
    public void isSelect(boolean b) {
        setSelect(b);
    }

    @Override
    public boolean getSelect() {
        return isSelect();
    }





    //今日的数据
    public boolean isToday() {
        String format = "yyyyMMdd";
        String dateMsg = TimeUtil.TimeStamp2Date(create_time, format);
        String todayDateMsg = TimeUtil.TimeStamp2Date(System.currentTimeMillis(), format);
//        LogUtil.println("isToday", dateMsg, todayDateMsg);
        return TextUtils.equals(dateMsg, todayDateMsg);
    }

    //空数据
    public boolean isNull() {
        return id == 0;
    }
}
