#pragma once

//-----------------------------------------------------------------------------
// General errors
//-----------------------------------------------------------------------------
#define ORIGIN_ERROR                   0xA0000000
#define ORIGIN_WARNING                 0x40000000
#define ORIGIN_ERROR_AREA_GENERAL      0x00000000
#define ORIGIN_ERROR_AREA_SDK          (1<<16)
#define ORIGIN_ERROR_AREA_CORE         (2<<16)
#define ORIGIN_ERROR_AREA_IGO          (3<<16)
#define ORIGIN_ERROR_AREA_FRIENDS      (4<<16)
#define ORIGIN_ERROR_AREA_PRESENCE     (5<<16)
#define ORIGIN_ERROR_AREA_COMMERCE     (6<<16)
#define ORIGIN_ERROR_AREA_ACHIEVEMENTS (7<<16)
#define ORIGIN_ERROR_AREA_LSX          (8<<16)
#define ORIGIN_ERROR_AREA_PROXY        (9<<16)
#define ORIGIN_ERROR_LEVEL_SHIFT       24
#define ORIGIN_ERROR_LEVEL_MASK        0x0F000000
#define ORIGIN_LEVEL_0                 (0<<24)
#define ORIGIN_LEVEL_1                 (1<<24)
#define ORIGIN_LEVEL_2                 (2<<24)
#define ORIGIN_LEVEL_3                 (3<<24)
#define ORIGIN_LEVEL_4                 (4<<24)

//-----------------------------------------------------------------------------
// Origin errors
//-----------------------------------------------------------------------------
#define ORIGIN_SUCCESS                                                                                        0
#define ORIGIN_PENDING                                                                                        1
#define ORIGIN_ERROR_GENERAL                                                                                 -1
#define ORIGIN_ERROR_INVALID_HANDLE                  (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_GENERAL + 0)
#define ORIGIN_ERROR_OUT_OF_MEMORY                   (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_GENERAL + 1)
#define ORIGIN_ERROR_NOT_IMPLEMENTED                 (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_GENERAL + 2)
#define ORIGIN_ERROR_INVALID_USER                    (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 3)
#define ORIGIN_ERROR_INVALID_ARGUMENT                (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 4)
#define ORIGIN_ERROR_NO_CALLBACK_SPECIFIED           (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 5)
#define ORIGIN_ERROR_BUFFER_TOO_SMALL                (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 6)
#define ORIGIN_ERROR_TOO_MANY_VALUES_IN_LIST         (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 7)
#define ORIGIN_ERROR_NOT_FOUND                       (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 8)
#define ORIGIN_ERROR_INVALID_PERSONA                 (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 9)
#define ORIGIN_ERROR_NO_NETWORK                      (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 10)
#define ORIGIN_ERROR_NO_SERVICE                      (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 11)
#define ORIGIN_ERROR_NOT_LOGGED_IN                   (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 12)
#define ORIGIN_ERROR_MANDATORY_ORIGIN_UPDATE_PENDING (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 13)
#define ORIGIN_ERROR_ACCOUNT_IN_USE                  (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 14)
#define ORIGIN_ERROR_TOO_MANY_INSTANCES              (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_GENERAL + 15)
#define ORIGIN_ERROR_ALREADY_EXISTS                  (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_GENERAL + 16)
#define ORIGIN_ERROR_INVALID_OPERATION               (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 17)
#define ORIGIN_ERROR_AGE_RESTRICTED                  (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 18)
#define ORIGIN_ERROR_BANNED                          (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 19)
#define ORIGIN_ERROR_NOT_READY                       (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 20)

//-----------------------------------------------------------------------------
// SDK errors
//-----------------------------------------------------------------------------
#define ORIGIN_ERROR_SDK_NOT_INITIALIZED            (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_SDK + 0)
#define ORIGIN_ERROR_SDK_INVALID_ALLOCATOR_DEALLOCATOR_COMBINATION (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_SDK + 1)
#define ORIGIN_ERROR_SDK_IS_RUNNING                 (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 2)
#define ORIGIN_ERROR_SDK_NOT_ALL_RESOURCES_RELEASED (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_SDK + 3)
#define ORIGIN_ERROR_SDK_INVALID_RESOURCE           (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 4)
#define ORIGIN_ERROR_SDK_INTERNAL_ERROR             (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_SDK + 5)
#define ORIGIN_ERROR_SDK_INTERNAL_BUFFER_TOO_SMALL  (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_SDK + 6)

//-----------------------------------------------------------------------------
// SDK warnings
//-----------------------------------------------------------------------------
#define ORIGIN_WARNING_SDK_ALREADY_INITIALIZED   (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 1)
#define ORIGIN_WARNING_SDK_STILL_RUNNING         (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 2)
#define ORIGIN_WARNING_SDK_ENUMERATOR_IN_USE     (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 3)
#define ORIGIN_WARNING_SDK_ENUMERATOR_TERMINATED (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 4)

//-----------------------------------------------------------------------------
// Core errors
//-----------------------------------------------------------------------------
#define ORIGIN_ERROR_CORE_NOTLOADED             (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_CORE + 0)
#define ORIGIN_ERROR_CORE_LOGIN_FAILED          (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 1)
#define ORIGIN_ERROR_CORE_AUTHENTICATION_FAILED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 2
#define ORIGIN_ERROR_CORE_SEND_FAILED           (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 4)
#define ORIGIN_ERROR_CORE_RECEIVE_FAILED        (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 5)
#define ORIGIN_ERROR_CORE_RESOURCE_NOT_FOUND    (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 6)
#define ORIGIN_ERROR_CORE_INCOMPATIBLE_VERSION  (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_CORE + 7)
#define ORIGIN_ERROR_CORE_NOT_INSTALLED         (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_CORE + 8)

//-----------------------------------------------------------------------------
// In-game overlay errors
//-----------------------------------------------------------------------------
#define ORIGIN_WARNING_IGO_NOTLOADED            (ORIGIN_WARNING + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_IGO + 0)
#define ORIGIN_WARNING_IGO_SUPPORT_NOTLOADED    (ORIGIN_WARNING + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_IGO + 1)
#define ORIGIN_ERROR_IGO_ILLEGAL_ANCHOR_POINT   (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_IGO + 2)
#define ORIGIN_ERROR_IGO_ILLEGAL_DOCK_POINT     (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_IGO + 3)
#define ORIGIN_ERROR_IGO_NOT_AVAILABLE          (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_IGO + 4)

//-----------------------------------------------------------------------------
// Presence errors
//-----------------------------------------------------------------------------
#define ORIGIN_ERROR_NO_MULTIPLAYER_ID          (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PRESENCE + 0)

//-----------------------------------------------------------------------------
// LSX errors
//-----------------------------------------------------------------------------
#define ORIGIN_ERROR_LSX_INVALID_RESPONSE       (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_LSX + 0)
#define ORIGIN_ERROR_LSX_NO_RESPONSE            (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_LSX + 1)
#define ORIGIN_ERROR_LSX_INVALID_REQUEST        (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_LSX + 2)

//-----------------------------------------------------------------------------
// Commerce errors
//-----------------------------------------------------------------------------
#define ORIGIN_ERROR_COMMERCE_NO_SUCH_STORE     (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_COMMERCE + 0)
#define ORIGIN_ERROR_COMMERCE_NO_SUCH_CATALOG   (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_COMMERCE + 1)
#define ORIGIN_ERROR_COMMERCE_INVALID_REPLY     (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_COMMERCE + 2)
#define ORIGIN_ERROR_COMMERCE_NO_CATEGORIES     (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 3)
#define ORIGIN_ERROR_COMMERCE_NO_PRODUCTS       (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 4)
#define ORIGIN_ERROR_COMMERCE_UNDERAGE_USER     (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 5)
#define ORIGIN_ERROR_COMMERCE_DEPRECATED_STORE  (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 6)
#define ORIGIN_ERROR_PROXY                      (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 0)
#define ORIGIN_SUCCESS_PROXY_OK                 (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 200)
#define ORIGIN_SUCCESS_PROXY_CREATED            (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 201)
#define ORIGIN_SUCCESS_PROXY_ACCEPTED           (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 202)
#define ORIGIN_SUCCESS_PROXY_NON_AUTH_INFO      (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 203)
#define ORIGIN_SUCCESS_PROXY_NO_CONTENT         (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 204)
#define ORIGIN_SUCCESS_RESET_CONTENT            (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 205)
#define ORIGIN_SUCCESS_PARTIAL_CONTENT          (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 206)
#define ORIGIN_ERROR_PROXY_BAD_REQUEST          (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 400)
#define ORIGIN_ERROR_PROXY_UNAUTHORIZED         (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 401)
#define ORIGIN_ERROR_PROXY_PAYMENT_REQUIRED     (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 402)
#define ORIGIN_ERROR_PROXY_FORBIDDEN            (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 403)
#define ORIGIN_ERROR_PROXY_NOT_FOUND            (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 404)
#define ORIGIN_ERROR_PROXY_METHOD_NOT_ALLOWED   (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 405)
#define ORIGIN_ERROR_PROXY_NOT_ACCEPTABLE       (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 406)
#define ORIGIN_ERROR_PROXY_REQUEST_TIMEOUT      (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 408)
#define ORIGIN_ERROR_PROXY_CONFLICT             (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 409)
#define ORIGIN_ERROR_PROXY_INTERNAL_ERROR       (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 500)
#define ORIGIN_ERROR_PROXY_NOT_IMPLEMENTED      (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 501)
#define ORIGIN_ERROR_PROXY_BAD_GATEWAY          (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 502)
#define ORIGIN_ERROR_PROXY_SERVICE_UNAVAILABLE  (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 503)
#define ORIGIN_ERROR_PROXY_GATEWAY_TIMEOUT      (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 504)
