package com.sheep.gamegroup.model.entity;

import android.text.TextUtils;

import com.alibaba.fastjson.annotation.JSONField;
import com.kfzs.duanduan.utils.NumberFormatUtils;
import com.sheep.gamegroup.util.ListUtil;

import java.util.Date;
import java.util.List;
import java.util.Locale;

/**
 * Created by realicing on 2018/9/17.
 * realicing@sina.com
 */
public class PunchStarList {
    @JSONField(name = "continue")
    private PunchUser go_continue;
    private PunchUser early;
    private PunchUser total;

    public PunchUser getGo_continue() {
        return go_continue;
    }

    public void setGo_continue(PunchUser go_continue) {
        this.go_continue = go_continue;
    }

    public PunchUser getEarly() {
        return early;
    }

    public void setEarly(PunchUser early) {
        this.early = early;
    }

    public PunchUser getTotal() {
        return total;
    }

    public void setTotal(PunchUser total) {
        this.total = total;
    }




    public List<PunchUser> getList() {
        if(early != null && !TextUtils.isEmpty(early.getDesc())){
            Date date = new Date();
            date.setTime(1000*NumberFormatUtils.parseLong(early.getDesc()));
            early.setDescText(String.format(Locale.CHINA, "%tR打卡", date));
        }
        if(total != null && !TextUtils.isEmpty(total.getDesc())){
            total.setDescText(String.format(Locale.CHINA, "累计%s次打卡", total.getDesc()));
        }
        if(go_continue != null && !TextUtils.isEmpty(go_continue.getDesc())){
            go_continue.setDescText(String.format(Locale.CHINA, "连续%s次打卡", go_continue.getDesc()));
        }
        return ListUtil.asList(early, total, go_continue);
    }
}
