export class StatusCode {
  // 1xx Informational
  static CONTINUE = 100;
  static SWITCHING_PROTOCOLS = 101;
  static PROCESSING = 102;
  static EARLY_HINTS = 103;

  // 2xx Success
  static OK = 200;
  static CREATED = 201;
  static ACCEPTED = 202;
  static NON_AUTHORITATIVE_INFORMATION = 203;
  static NO_CONTENT = 204;
  static RESET_CONTENT = 205;
  static PARTIAL_CONTENT = 206;
  static MULTI_STATUS = 207;
  static ALREADY_REPORTED = 208;
  static IM_USED = 226;

  // 3xx Redirection
  static MULTIPLE_CHOICES = 300;
  static MOVED_PERMANENTLY = 301;
  static FOUND = 302;
  static SEE_OTHER = 303;
  static NOT_MODIFIED = 304;
  static USE_PROXY = 305;
  static TEMPORARY_REDIRECT = 307;
  static PERMANENT_REDIRECT = 308;

  // 4xx Client Error
  static BAD_REQUEST = 400;
  static UNAUTHORIZED = 401;
  static PAYMENT_REQUIRED = 402;
  static FORBIDDEN = 403;
  static NOT_FOUND = 404;
  static METHOD_NOT_ALLOWED = 405;
  static NOT_ACCEPTABLE = 406;
  static PROXY_AUTHENTICATION_REQUIRED = 407;
  static REQUEST_TIMEOUT = 408;
  static CONFLICT = 409;
  static GONE = 410;
  static LENGTH_REQUIRED = 411;
  static PRECONDITION_FAILED = 412;
  static PAYLOAD_TOO_LARGE = 413;
  static URI_TOO_LONG = 414;
  static UNSUPPORTED_MEDIA_TYPE = 415;
  static REQUESTED_RANGE_NOT_SATISFIABLE = 416;
  static EXPECTATION_FAILED = 417;
  static I_AM_A_TEAPOT = 418;
  static MISDIRECTED_REQUEST = 421;
  static UNPROCESSABLE_ENTITY = 422;
  static LOCKED = 423;
  static FAILED_DEPENDENCY = 424;
  static TOO_EARLY = 425;
  static UPGRADE_REQUIRED = 426;
  static PRECONDITION_REQUIRED = 428;
  static TOO_MANY_REQUESTS = 429;
  static REQUEST_HEADER_FIELDS_TOO_LARGE = 431;
  static UNAVAILABLE_FOR_LEGAL_REASONS = 451;

  // 5xx Server Error
  static INTERNAL_SERVER_ERROR = 500;
  static NOT_IMPLEMENTED = 501;
  static BAD_GATEWAY = 502;
  static SERVICE_UNAVAILABLE = 503;
  static GATEWAY_TIMEOUT = 504;
  static HTTP_VERSION_NOT_SUPPORTED = 505;
  static VARIANT_ALSO_NEGOTIATES = 506;
  static INSUFFICIENT_STORAGE = 507;
  static LOOP_DETECTED = 508;
  static NOT_EXTENDED = 510;
  static NETWORK_AUTHENTICATION_REQUIRED = 511;

  static getReasonPhrase(code: number): string {
    switch (code) {
      // 1xx Informational
      case 100:
        return 'Continue';
      case 101:
        return 'Switching Protocols';
      case 102:
        return 'Processing';
      case 103:
        return 'Early Hints';

      // 2xx Success
      case 200:
        return 'OK';
      case 201:
        return 'Created';
      case 202:
        return 'Accepted';
      case 203:
        return 'Non-Authoritative Information';
      case 204:
        return 'No Content';
      case 205:
        return 'Reset Content';
      case 206:
        return 'Partial Content';
      case 207:
        return 'Multi-Status';
      case 208:
        return 'Already Reported';
      case 226:
        return 'IM Used';

      // 3xx Redirection
      case 300:
        return 'Multiple Choices';
      case 301:
        return 'Moved Permanently';
      case 302:
        return 'Found';
      case 303:
        return 'See Other';
      case 304:
        return 'Not Modified';
      case 305:
        return 'Use Proxy';
      case 307:
        return 'Temporary Redirect';
      case 308:
        return 'Permanent Redirect';

      // 4xx Client Error
      case 400:
        return 'Bad Request';
      case 401:
        return 'Unauthorized';
      case 402:
        return 'Payment Required';
      case 403:
        return 'Forbidden';
      case 404:
        return 'Not Found';
      case 405:
        return 'Method Not Allowed';
      case 406:
        return 'Not Acceptable';
      case 407:
        return 'Proxy Authentication Required';
      case 408:
        return 'Request Timeout';
      case 409:
        return 'Conflict';
      case 410:
        return 'Gone';
      case 411:
        return 'Length Required';
      case 412:
        return 'Precondition Failed';
      case 413:
        return 'Payload Too Large';
      case 414:
        return 'URI Too Long';
      case 415:
        return 'Unsupported Media Type';
      case 416:
        return 'Range Not Satisfiable';
      case 417:
        return 'Expectation Failed';
      case 418:
        return "I'm a teapot";
      case 421:
        return 'Misdirected Request';
      case 422:
        return 'Unprocessable Entity';
      case 423:
        return 'Locked';
      case 424:
        return 'Failed Dependency';
      case 425:
        return 'Too Early';
      case 426:
        return 'Upgrade Required';
      case 428:
        return 'Precondition Required';
      case 429:
        return 'Too Many Requests';
      case 431:
        return 'Request Header Fields Too Large';
      case 451:
        return 'Unavailable For Legal Reasons';

      // 5xx Server Error
      case 500:
        return 'Internal Server Error';
      case 501:
        return 'Not Implemented';
      case 502:
        return 'Bad Gateway';
      case 503:
        return 'Service Unavailable';
      case 504:
        return 'Gateway Timeout';
      case 505:
        return 'HTTP Version Not Supported';
      case 506:
        return 'Variant Also Negotiates';
      case 507:
        return 'Insufficient Storage';
      case 508:
        return 'Loop Detected';
      case 510:
        return 'Not Extended';
      case 511:
        return 'Network Authentication Required';

      // Default case
      default:
        return 'Unknown Status';
    }
  }

  static isInformational(code: number): boolean {
    return code >= 100 && code < 200;
  }

  static isSuccess(code: number): boolean {
    return code >= 200 && code < 300;
  }

  static isRedirection(code: number): boolean {
    return code >= 300 && code < 400;
  }

  static isClientError(code: number): boolean {
    return code >= 400 && code < 500;
  }

  static isServerError(code: number): boolean {
    return code >= 500 && code < 600;
  }
}
