/*
 * OPEN OUTCRY API
 *
 * # Introduction This API is documented in **OpenAPI 3.0 format**.  This API the following operations: * Retrieve a list of available instruments * Retrieve a list of executed trades  # Basics * API calls have to be secured with HTTPS. * All data has to be submitted UTF-8 encoded. * The reply is sent JSON encoded.
 *
 * API version: 1.0.0
 * Generated by: OpenAPI Generator (https://openapi-generator.tech)
 */

package api

import (
	"fmt"
)

type TradeOrderStatus string

// List of TradeOrderStatus
const (
	OPEN                TradeOrderStatus = "OPEN"
	REJECTED            TradeOrderStatus = "REJECTED"
	CANCELLED           TradeOrderStatus = "CANCELLED"
	PARTIALLY_CANCELLED TradeOrderStatus = "PARTIALLY_CANCELLED"
	PARTIALLY_REJECTED  TradeOrderStatus = "PARTIALLY_REJECTED"
	FILLED              TradeOrderStatus = "FILLED"
)

// AllowedTradeOrderStatusEnumValues is all the allowed values of TradeOrderStatus enum
var AllowedTradeOrderStatusEnumValues = []TradeOrderStatus{
	"OPEN",
	"REJECTED",
	"CANCELLED",
	"PARTIALLY_CANCELLED",
	"PARTIALLY_REJECTED",
	"FILLED",
}

// validTradeOrderStatusEnumValue provides a map of TradeOrderStatuss for fast verification of use input
var validTradeOrderStatusEnumValues = map[TradeOrderStatus]struct{}{
	"OPEN":                {},
	"REJECTED":            {},
	"CANCELLED":           {},
	"PARTIALLY_CANCELLED": {},
	"PARTIALLY_REJECTED":  {},
	"FILLED":              {},
}

// IsValid return true if the value is valid for the enum, false otherwise
func (v TradeOrderStatus) IsValid() bool {
	_, ok := validTradeOrderStatusEnumValues[v]
	return ok
}

// NewTradeOrderStatusFromValue returns a pointer to a valid TradeOrderStatus
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewTradeOrderStatusFromValue(v string) (TradeOrderStatus, error) {
	ev := TradeOrderStatus(v)
	if ev.IsValid() {
		return ev, nil
	} else {
		return "", fmt.Errorf("invalid value '%v' for TradeOrderStatus: valid values are %v", v, AllowedTradeOrderStatusEnumValues)
	}
}

// AssertTradeOrderStatusRequired checks if the required fields are not zero-ed
func AssertTradeOrderStatusRequired(obj TradeOrderStatus) error {
	return nil
}

// AssertTradeOrderStatusConstraints checks if the values respects the defined constraints
func AssertTradeOrderStatusConstraints(obj TradeOrderStatus) error {
	return nil
}
