package kr.co.hanwha.hifive.util;

import kr.co.hanwha.hifive.data.model.DabProjectData;
import kr.co.hanwha.hifive.data.model.ProjectTaskInfo;
import kr.co.hanwha.hifive.data.model.TaskDetailRoot;
import kr.co.hanwha.hifive.data.model.TaskListData;

public class HFLogUtil {
    public static String getLogData(TaskDetailRoot root) {
        if (root != null)
            return root.toString();
        else return "";
    }

    public static String getLogData(TaskListData data) {
        if (data != null)
            return "TASK : " + data.getTask_id() +
                    " PROJECT : " + data.getProject_id() +
                    " TRACK : " + data.getTrack_id() +
                    "\nAuthorMemberId : " + data.getAuthor_member_id() +
                    " MemberId : " + data.getMember_id();
        else return "";
    }

    public static String getLogData(DabProjectData data) {
        if (data != null) {
            String log = "Project Id : " + data.getProject_id();
            if (data.getListCaptains() != null && data.getListCaptains().size() > 0) {
                log += "\nCaptain : ";
                for (int i = 0; i < data.getListCaptains().size(); i++) {
                    log += (i == 0 ? "" : ", ") + data.getListCaptains().get(i).getMember_id()
                            + "(" + data.getListCaptains().get(i).getRole_code() + ")";
                }
            }
            return log;
        } else return "";
    }

    public static String getLogData(ProjectTaskInfo data) {
        if (data != null)
            return "TASK : " + data.getId() + " MemberId : " + data.getMember_id();
        else return "";
    }
}
