// Copyright (C) 2010-2016  MarketFactory, Inc. All Rights Reserved.
//================================================================================
//   This file is auto-generated; DO NOT EDIT!
//================================================================================

#ifndef __MFAPIGEN_REJECTREASON__
#define __MFAPIGEN_REJECTREASON__

#include <iostream>

namespace MFAPI {

/** (Enum) The reason that the request failed.
 */

struct RejectReason
{
    enum Type {
    NOT_SUBSCRIBED = 0,
    UNKNOWN_SYMBOL = 1,
    EXCHANGE_NOT_AVAILABLE = 2,
    CREDIT_LOW = 3,
    DUPLICATE_ORDER = 6,
    INCORRECT_QUANTITY = 13,
    INCORRECT_PRICE = 17,
    INVALID_ORDER = 18,
    INVALID_FEED = 20,
    INVALID_MARKET = 21,
    FEED_DOWN = 22,
    INVALID_ORDER_TYPE = 23,
    INVALID_TIME_IN_FORCE = 24,
    INVALID_CLORDID = 25,
    UNKNOWN_ORDER = 27,
    TOO_MANY_ORDER_SUBMITS = 28,
    RESEND_REQUESTED = 29,
    MARKET_NOT_ACTIVE = 30,
    LOCKED_USER = 31,
    EXCEEDS_NOP_LIMIT = 32,
    EXCEEDS_DSL_LIMIT = 33,
    EXCEEDS_POSITION_LIMIT = 34,
    EXCEEDS_PENDING_LIMIT = 35,
    EXCEEDS_SINGLE_LIMIT = 36,
    TRADE_LIMIT_RESTRICTION = 40,
    INVALID_MODEL = 45,
    NOT_APPLICABLE = 254
    };

    static const char* Name;

    static void initializeEnum();
    static void finalizeEnum();

    static bool isValid( unsigned char iv );

    // Convert from an emum to various other things.
    static unsigned char toValue( Type iv );
    static const char* toString( unsigned char iv );
    static unsigned char toIndex( Type );

    // Convert from various other things to an enum.
    static Type fromValue( unsigned char iv );
    static Type fromIndex( unsigned char index );
    static Type fromString( const char* );

private:
    static bool _initialized;
    static const unsigned int _maxValue;
    static const unsigned int _nbValues;

    static const char* _names[255];
    static unsigned char _toIndex[255];
    static Type _fromIndex[27];

};

std::ostream& operator<<( std::ostream& os, RejectReason::Type en );

} // MFAPI

#endif
// InclKwds: RejectReason
