import 'package:flutter/material.dart';
import 'package:test_sa/extensions/context_extension.dart';

class AppColor {
  AppColor._();

  //primary
  static const Color primary30 = Color(0xffA2E2F8);
  static const Color primary40 = Color(0xff75BDE0);
  static const Color primary50 = Color(0xff4A8DB7);
  static const Color primary60 = Color(0xff3B7097);
  static const Color primary70 = Color(0xff163A51);

  //texts
  static const Color neutral10 = Color(0xffBCBCBC);
  static const Color neutral20 = Color(0xff767676);
  static const Color neutral30 = Color(0xffEAF1F4);
  static const Color neutral40 = Color(0xffE4E5E6);
  static const Color neutral50 = Color(0xff3B3D4A);
  static const Color neutral60 = Color(0xff2C2C31);
  static const Color neutral70 = Color(0xff111427);

  //background
  static const Color backgroundLight = Color(0xffF7F9FB);
  static const Color backgroundDark = Color(0xff111427);

  //red
  static const Color red40 = Color(0xffFFDBDC);
  static const Color red50 = Color(0xffD02127);
  static const Color red60 = Color(0xff8C050A);

  //green
  static const Color green40 = Color(0xffBAFFE1);
  static const Color green50 = Color(0xff62BE96);
  static const Color green60 = Color(0xff065E38);

  //orange
  static const Color orange40 = Color(0xffFFEDBC);
  static const Color orange50 = Color(0xffCC9B14);
  static const Color orange60 = Color(0xff886400);

  static Color greenStatus(BuildContext context) => context.isDark ? const Color(0xff1FA269) : green50;

  static Color blueStatus(BuildContext context) => context.isDark ? primary40 : primary50;

  static Color redStatus(BuildContext context) => context.isDark ? const Color(0xffFFB6B8) : red40;

  static Color yellowStatus(BuildContext context) => context.isDark ? const Color(0xffFFDA76) : orange40;

  static Color background(BuildContext context) => context.isDark ? neutral60 : Colors.white;

  static Color selectedButtonColor(BuildContext context) => context.isDark ? neutral60 : neutral30;

  static Color unSelectedButtonColor(BuildContext context) => context.isDark ? neutral60 : Colors.white;

  static Color filterButtonTextColor(BuildContext context) => context.isDark ? neutral30 : neutral50;

  static Color getRequestStatusTextColorByName(BuildContext context, String status) {
    switch ((status ?? "").toLowerCase()) {
      case "in progress":
        return orange60;
      case "high priority":
        return red60;
      default:
        return Colors.white;
    }
  }

  static Color getRequestStatusColorByName(BuildContext context, String status) {
    switch ((status ?? "").toLowerCase()) {
      case "medium":
        return blueStatus(context);
      case "in progress":
        return yellowStatus(context);
      case "complete":
        return greenStatus(context);
      case "closed":
        return greenStatus(context);
      case "high priority":
        return redStatus(context);
      case "low priority":
        return greenStatus(context);
      case "open":
        return blueStatus(context);
      default:
        return greenStatus(context);
    }
  }

  static Color getRequestStatusColor(BuildContext context, int id) {
    switch (id) {
      case 1:
        return blueStatus(context);
      case 2:
        return yellowStatus(context);
      case 3:
        return greenStatus(context);
      case 4:
        return redStatus(context);
      case 6:
        return greenStatus(context);
      case 5:
        return greenStatus(context);
      case 8:
        return greenStatus(context);
      case 9:
        return orange40;
      default:
        return blueStatus(context);
    }
  }

  static Color getRequestStatusTextColor(BuildContext context, int id) {
    switch (id) {
      case 2:
        return orange60;
      case 4:
        return red60;
      case 9:
        return orange60;
      default:
        return Colors.white;
    }
  }

  static Color getPriorityStatusTextColor(BuildContext context, int id) {
    switch (id) {
      case 81:
        return Colors.white;
      case 82:
        return red60;
      default:
        return blueStatus(context);
    }
  }

  static Color getPriorityStatusColor(BuildContext context, int id) {
    switch (id) {
      case 81:
        return greenStatus(context);
      case 82:
        return redStatus(context);
      default:
        return blueStatus(context);
    }
  }
}
