
class ApiConstants {

  static const String APPWRITE_ENDPOINT = "https://cloud.appwrite.io/v1";
  static const String APPWRITE_PROJECT_ID = "6633d0e00023502890ed";

  static const String INFO_Q_DATABASE_ID = "65de5cab16717444527b";
    static const String MANUAL_Q_COLLECTION_ID = "65de9f2f925562a2eda8";
    static const String INFORMATION_Q_COLLECTION_ID = "65de9f1b6282fd209bdb";
    static const String DEST_Q_COLLECTION_ID = "65de9ef464bfa5a0693d";
    static const String COMMANDS_COLLECTION_ID = "65e035c82dbae432bafe";




  // function to convert date time to something that looks like: Today at 12:00 PM or Yesterday at 12:00 PM or 12/31/2021 at 12:00 PM, make sure to always use double digits for the time so 01 not 1
  static String formatDateTime(DateTime dateTime) {
    DateTime now = DateTime.now();
    DateTime today = DateTime(now.year, now.month, now.day);
    DateTime yesterday = DateTime(now.year, now.month, now.day - 1);

    if (dateTime.isAfter(today)) {
      return "Today at ${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')} ${dateTime.hour > 12 ? "PM" : "AM"}";
    } else if (dateTime.isAfter(yesterday)) {
      return "Yesterday at ${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')} ${dateTime.hour > 12 ? "PM" : "AM"}";
    } else {
      return "${dateTime.month.toString().padLeft(2, '0')}/${dateTime.day.toString().padLeft(2, '0')}/${dateTime.year.toString().padLeft(2, '0')} at ${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')} ${dateTime.hour > 12 ? "PM" : "AM"}";
    }
  }


}