//====== Copyright © 1996-2010, Valve Corporation, All rights reserved. =======
//
// Purpose: HTTP related enums, stuff that is shared by both clients and servers, and our
// UI projects goes here.
//
//=============================================================================

#ifndef STEAMHTTPENUMS_H
#define STEAMHTTPENUMS_H
#ifdef _WIN32
#pragma once
#endif

// HTTP related types

// This enum is used in client API methods, do not re-number existing values.
enum EHTTPMethod
{
	k_EHTTPMethodInvalid = 0,
	k_EHTTPMethodGET,
	k_EHTTPMethodHEAD,
	k_EHTTPMethodPOST,
	k_EHTTPMethodPUT,
	k_EHTTPMethodDELETE,
	k_EHTTPMethodOPTIONS,
	k_EHTTPMethodPATCH,

	// The remaining HTTP methods are not yet supported, per rfc2616 section 5.1.1 only GET and HEAD are required for 
	// a compliant general purpose server.  We'll likely add more as we find uses for them.

	// k_EHTTPMethodTRACE,
	// k_EHTTPMethodCONNECT
};


// HTTP Status codes that the server can send in response to a request, see rfc2616 section 10.3 for descriptions
// of each of these.
enum EHTTPStatusCode
{
	// Invalid status code (this isn't defined in HTTP, used to indicate unset in our code)
	k_EHTTPStatusCodeInvalid = 0,

	// Informational codes
	k_EHTTPStatusCode100Continue = 100,
	k_EHTTPStatusCode101SwitchingProtocols = 101,

	// Success codes
	k_EHTTPStatusCode200OK = 200,
	k_EHTTPStatusCode201Created = 201,
	k_EHTTPStatusCode202Accepted = 202,
	k_EHTTPStatusCode203NonAuthoritative = 203,
	k_EHTTPStatusCode204NoContent = 204,
	k_EHTTPStatusCode205ResetContent = 205,
	k_EHTTPStatusCode206PartialContent = 206,

	// Redirection codes
	k_EHTTPStatusCode300MultipleChoices = 300,
	k_EHTTPStatusCode301MovedPermanently = 301,
	k_EHTTPStatusCode302Found = 302,
	k_EHTTPStatusCode303SeeOther = 303,
	k_EHTTPStatusCode304NotModified = 304,
	k_EHTTPStatusCode305UseProxy = 305,
	//k_EHTTPStatusCode306Unused =				306, (used in old HTTP spec, now unused in 1.1)
	k_EHTTPStatusCode307TemporaryRedirect = 307,
	k_EHTTPStatusCode308PermanentRedirect = 308,

	// Error codes
	k_EHTTPStatusCode400BadRequest = 400,
	k_EHTTPStatusCode401Unauthorized = 401, // You probably want 403 or something else. 401 implies you're sending a WWW-Authenticate header and the client can sent an Authorization header in response.
	k_EHTTPStatusCode402PaymentRequired = 402, // This is reserved for future HTTP specs, not really supported by clients
	k_EHTTPStatusCode403Forbidden = 403,
	k_EHTTPStatusCode404NotFound = 404,
	k_EHTTPStatusCode405MethodNotAllowed = 405,
	k_EHTTPStatusCode406NotAcceptable = 406,
	k_EHTTPStatusCode407ProxyAuthRequired = 407,
	k_EHTTPStatusCode408RequestTimeout = 408,
	k_EHTTPStatusCode409Conflict = 409,
	k_EHTTPStatusCode410Gone = 410,
	k_EHTTPStatusCode411LengthRequired = 411,
	k_EHTTPStatusCode412PreconditionFailed = 412,
	k_EHTTPStatusCode413RequestEntityTooLarge = 413,
	k_EHTTPStatusCode414RequestURITooLong = 414,
	k_EHTTPStatusCode415UnsupportedMediaType = 415,
	k_EHTTPStatusCode416RequestedRangeNotSatisfiable = 416,
	k_EHTTPStatusCode417ExpectationFailed = 417,
	k_EHTTPStatusCode4xxUnknown = 418, // 418 is reserved, so we'll use it to mean unknown
	k_EHTTPStatusCode421MisdirectedRequest = 421,
	k_EHTTPStatusCode422UnprocessableContent = 422,
	k_EHTTPStatusCode423Locked = 423,
	k_EHTTPStatusCode424FailedDependency = 424,
	k_EHTTPStatusCode425TooEarly = 425,
	k_EHTTPStatusCode426UpgradeRequired = 426,
	k_EHTTPStatusCode428PreconditionRequired = 428,
	k_EHTTPStatusCode429TooManyRequests = 429,
	k_EHTTPStatusCode431RequestHeaderFieldsTooLarge = 431,
	k_EHTTPStatusCode444ConnectionClosed = 444, // nginx only?
	k_EHTTPStatusCode451UnavailableForLegalReasons = 451,

	// Server error codes
	k_EHTTPStatusCode500InternalServerError = 500,
	k_EHTTPStatusCode501NotImplemented = 501,
	k_EHTTPStatusCode502BadGateway = 502,
	k_EHTTPStatusCode503ServiceUnavailable = 503,
	k_EHTTPStatusCode504GatewayTimeout = 504,
	k_EHTTPStatusCode505HTTPVersionNotSupported = 505,
	k_EHTTPStatusCode506VariantAlsoNegotiates = 506,
	k_EHTTPStatusCode507InsufficientStorage = 507,
	k_EHTTPStatusCode508LoopDetected = 508,
	k_EHTTPStatusCode510NotExtended = 510,
	k_EHTTPStatusCode511NetworkAuthenticationRequired = 511,
	k_EHTTPStatusCode5xxUnknown =				599,
};

inline bool BIsHTTPStatusSuccess( EHTTPStatusCode eStatus )
{
	return eStatus >= 200 && eStatus <= 299;
}

#endif // STEAMHTTPENUMS_H
