package kr.co.hanwha.hifive.data.model;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;

import kr.co.hanwha.hifive.util.HFDateUtil;

/**
 * Created by sanghoonkwon on 2018. 1. 18..
 */

public class MemberInfoData {
    /**
     * 256
     */
    int member_id;
    /**
     * "안세준"
     */
    String member_name;
    /**
     * 32
     */
    int project_id;
    /**
     * "NewGW-Dev"
     */
    String project_name;
    /**
     * 0
     */
    int package_id;
    /**
     * ""
     */
    String package_name;
    /**
     * 0
     */
    int track_id;
    /**
     * null
     */
    String track_name;
    /**
     * 20
     */
    int role_code;
    /**
     * "캡틴"
     */
    String role_name;
    /**
     * null
     */
    String profile_url;
    /**
     * 40
     */
    int rank_title;
    /**
     * "차장"
     */
    String rank;

    public int getTrack_id() {
        return track_id;
    }

    long selectedTime = 0;

    boolean isTopLine = false;

    public boolean isTopLine() {
        return isTopLine;
    }

    public void setTopLine(boolean topLine) {
        isTopLine = topLine;
    }

    public MemberInfoData() {

    }

    public MemberInfoData(@NonNull int member_id, @NonNull String member_name, @Nullable String profile_url,
                          @NonNull int project_id, @Nullable String project_name) {
        this.member_id = member_id;
        this.member_name = member_name;
        this.profile_url = profile_url;
        this.project_id = project_id;
        this.project_name = project_name;
    }

    public MemberInfoData(@NonNull LoginData loginData) {
        this.member_id = loginData.member_id;
        this.member_name = loginData.name;
        this.profile_url = loginData.profile_url;
        this.rank = loginData.position;
        if (loginData.getListMyProjectsInfo() != null && loginData.getListMyProjectsInfo().size() > 0) {
            this.project_id = loginData.getListMyProjectsInfo().get(0).getProject_id();
            this.project_name = loginData.getListMyProjectsInfo().get(0).getProject_name();
        }
    }

    public String getKey() {
        return project_id + "_ " + member_id;
    }

    public int getMember_id() {
        return member_id;
    }

    public String getMember_name() {
        return member_name;
    }

    public int getProject_id() {
        return project_id;
    }

    public String getProject_name() {
        return (TextUtils.isEmpty(project_name) ? "" : project_name);
    }

    public int getRole_code() {
        return role_code;
    }

    public String getRole_name() {
        return role_name;
    }

    public String getRank() {
        return rank;
    }

    public String getProfile_url() {
        return profile_url;
    }

    public long getSelectedTime() {
        return selectedTime;
    }

    public void setSelectedTime() {
        selectedTime = HFDateUtil.getTimestampToday();
    }

    public void clearSelectedTime() {
        selectedTime = 0;
    }
/*
{
"member_id": 256,
"member_name": "안세준",
"project_id": 32,
"project_name": "NewGW-Dev",
"package_id": 0,
"package_name": "",
"track_id": 0,
"track_name": null,
"role_code": 20,
"role_name": "캡틴",
"profile_url": null,
"rank_title": 40,
"rank": "차장"
},
*/
}
