package kr.co.hanwha.hifive.util;

import android.content.Context;
import android.graphics.drawable.Drawable;

import kr.co.hanwha.hifive.R;

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

public class HFTaskUtil {
    public static int getDueDateFontColor(Context context, String due_to, String server_time) {
        int d_day = HFDateUtil.getCalculateDDayFromToday(due_to, HFDateUtil.FORMAT_TASK_DUEDATE_SERVER);
        if (d_day > 0) return HFCommonUtil.getColor(context, R.color.gray_8e);
        else
            return HFCommonUtil.getColor(context, R.color.red_f0);
    }

    public static Drawable getDueDateIconDrawable(Context context, String due_to, String server_time) {
        int d_day = HFDateUtil.getCalculateDDayFromToday(due_to, HFDateUtil.FORMAT_TASK_DUEDATE_SERVER);
        if (d_day > 0) return context.getResources().getDrawable(R.mipmap.ic_date_gray);
        else
            return context.getResources().getDrawable(R.mipmap.ic_date_org);
    }

    public static String getDueDateText(Context context, String due_to, String server_time) {
        String dayStr = "";
        int d_day = HFDateUtil.getCalculateDDayFromToday(due_to, HFDateUtil.FORMAT_TASK_DUEDATE_SERVER);
        if (d_day == 0)
            dayStr = context.getString(R.string.task_main_duedate_today);
        else if (d_day > 0)
            dayStr = String.format(context.getString(R.string.task_main_duedate_left), d_day);
        else
            dayStr = String.format(context.getString(R.string.task_main_duedate_over), -d_day);

        return dayStr;
    }
}
