package com.cygnusa.hyperm.util;

import android.annotation.SuppressLint;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.view.Gravity;
import android.widget.Toast;

import com.cygnusa.hyperm.wrappers.Banner;
import com.cygnusa.hyperm.wrappers.CalanderEventList;
import com.cygnusa.hyperm.wrappers.DSEFeedbackResponse;
import com.cygnusa.hyperm.wrappers.DSETrainingFeedbackData;
import com.cygnusa.hyperm.wrappers.ErrorResponse;
import com.cygnusa.hyperm.wrappers.NotificationSummary;
import com.cygnusa.hyperm.wrappers.ScheduleData;
import com.cygnusa.hyperm.wrappers.SingleDateAttendance;
import com.cygnusa.hyperm.wrappers.TrainerFeedBackData;
import com.cygnusa.hyperm.wrappers.UserResponse;

import java.util.ArrayList;
import java.util.List;

public class GlobalData {

    public static final String SELECTID = "SELECTID";
    public static String DSEFEEDBACKRESPONSEGROUPIMAGE = "GroupImage";
    public static String STARTDATESTRING = "STARTDATESTRING";
    public static DSEFeedbackResponse.DSEFeedbackData DSEFEEDBACKVIEW = new DSEFeedbackResponse.DSEFeedbackData();
    public static String QRCODEVALUE = "QRCODEVALUE";
    public static int CALPOS = 0;
    public static String SCHEDULE_ID = "SCHEDULE_ID";
    public static int STARTDATE = 0;
    public static int ENDDATE = 0;
    public static boolean ISEDIT = true;
    public static int CURRENTMONTH = 0;
    public static int CURRENTYEAR = 0;
    public static int CURRENTDATE = 0;
    public static int SCANCLICKPOS = -1;
    public static boolean SCANCLICKRESULT = false;
    public static int IMAGECLICKPOS = -1;
    public static double trainerSum = 0f;
    public static double trainingSum = 0f;
    public static String APP_URL = "https://appstack.cygnusa.in/services/appstore.php?funname=appversion&appid=";

    public static String SERVER_URL = "https://hyper-m.cygnusa.in/_api/";

    public static String REPORT_URL = "https://hyper-m.cygnusa.in/#/";
    public static String FAQ_URL = "https://hyper-m.cygnusa.in/";
    public static String AppId = "com.cygnusa.hyperm";
    public static String EMI_URL = "https://hyper-m.cygnusa.in/emicalculator/";

//    public static String AppId = "com.cygnusa.hyperm";
//    public static String EMI_URL = "https://hyper-m.cygnusa.in/emicalculator/";

    public static UserResponse user = new UserResponse();
    public static ErrorResponse errorResponse = new ErrorResponse();
    public static ArrayList<Banner> BANNERS = new ArrayList<>();
    public static boolean canLogout = false;
    public static SQLiteDatabase sdb;
    public static int width = 0;
    public static String zmEmail = "none", rmEmail = "none", amEmail = "none";
    public static final String PRODUCT_NAME = "product_name";
    public static final String CURRENTTIME = "current_time";
    public static final String DETAIL_NAME = "DETAIL_NAME";
    public static final String DETAIL_EMAIL = "DETAIL_EMAIL";
    public static final String DETAIL_MOBILE = "DETAIL_MOBILE";
    public static final String SALUTATION_MODEL = "SALUTATION_MODEL";
    public static final String FEEDBACK_MODEL = "FEEDBACK_MODEL";
    public static final String WOOHOOCATID = "WOOHOOCATID";
    public static final String MYLEARNING = "Learning";
    public static final String PAGETITLE = "pageTitle";
    public static final String ISDSELOGIN = "Dse";
    public static final String ISMYLEARNING = "ISMyLearning";
    public static final String SERVER_ERROR = "Kindly check your internet connection.";
    public static final String SELECTED_MODEL_NAME = "SELECTED_MODEL_NAME";
    public static String PREFERENCES_NAME = "MYPREFRE";
    public static String VERSION_CODE = "VERSIONCODE";
    public static String SELECTED_MODEL = "SELECTED_MODEL";
    public static String OLD_VERSION_CODE = "OLD_VERSION_CODE";
    public static String ACCESS_TOKEN = "fak5uxyerpWhy8hW1w1hcmoTcXlH0hpfrJlVhUaJk70SfhPhOQz0cXTpUf6VwwbYgxUyr5hMchEszuJnkjnxghXbw473Ai2RPWph2G3eXIGxcqUxKi50z2c56j8HCbys";
    public static Toast toast;
    public static CalanderEventList fullSingleDataLists = new CalanderEventList();
    public static NotificationSummary notificationSummary = new NotificationSummary();
    public static List<ScheduleData> scheduledDataList = new ArrayList<>();
    //  public static List<DSETrainingFeedbackData> TrainerFeedbackQuestions = new ArrayList<>();

    public static DSETrainingFeedbackData DSEFeedbackQuestions = new DSETrainingFeedbackData();
    public static TrainerFeedBackData TrainerFeedbackData = new TrainerFeedBackData();
    public static SingleDateAttendance singleDateOneList = new SingleDateAttendance();


    public static void openDatabase(Context context) {
        try {
            sdb = new DatabaseHelper(context, "hyperm.db", null, 2).getWritableDatabase();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void toast(Context context, String str) {
        if (toast != null) {
            toast.cancel();
        }
        toast = Toast.makeText(context, str, Toast.LENGTH_SHORT);
        toast.show();
        toast.setGravity(Gravity.CENTER, 0, 0);
    }

    @SuppressLint("ShowToast")
    public static Toast showToast(Context context, String content, int length) {

        try {
            toast.cancel();
        } catch (Exception e) {
            e.printStackTrace();
        }

        toast = Toast.makeText(context, content, length);
        toast.setGravity(Gravity.CENTER, 0, 0);
        return toast;
    }


}
