/*
SpaceTraders API

SpaceTraders is an open-universe game and learning platform that offers a set of HTTP endpoints to control a fleet of ships and explore a multiplayer universe.  The API is documented using [OpenAPI](https://github.com/SpaceTradersAPI/api-docs). You can send your first request right here in your browser to check the status of the game server.  ```json http {   \"method\": \"GET\",   \"url\": \"https://api.spacetraders.io/v2\", } ```  Unlike a traditional game, SpaceTraders does not have a first-party client or app to play the game. Instead, you can use the API to build your own client, write a script to automate your ships, or try an app built by the community.  We have a [Discord channel](https://discord.com/invite/jh6zurdWk5) where you can share your projects, ask questions, and get help from other players.   

API version: 2.0.0
Contact: joel@spacetraders.io
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package stapi

import (
	"encoding/json"
	"fmt"
)

// FactionSymbols The symbol of the faction.
type FactionSymbols string

// List of FactionSymbols
const (
	FACTIONSYMBOLS_COSMIC FactionSymbols = "COSMIC"
	FACTIONSYMBOLS_VOID FactionSymbols = "VOID"
	FACTIONSYMBOLS_GALACTIC FactionSymbols = "GALACTIC"
	FACTIONSYMBOLS_QUANTUM FactionSymbols = "QUANTUM"
	FACTIONSYMBOLS_DOMINION FactionSymbols = "DOMINION"
	FACTIONSYMBOLS_ASTRO FactionSymbols = "ASTRO"
	FACTIONSYMBOLS_CORSAIRS FactionSymbols = "CORSAIRS"
	FACTIONSYMBOLS_OBSIDIAN FactionSymbols = "OBSIDIAN"
	FACTIONSYMBOLS_AEGIS FactionSymbols = "AEGIS"
	FACTIONSYMBOLS_UNITED FactionSymbols = "UNITED"
	FACTIONSYMBOLS_SOLITARY FactionSymbols = "SOLITARY"
	FACTIONSYMBOLS_COBALT FactionSymbols = "COBALT"
	FACTIONSYMBOLS_OMEGA FactionSymbols = "OMEGA"
	FACTIONSYMBOLS_ECHO FactionSymbols = "ECHO"
	FACTIONSYMBOLS_LORDS FactionSymbols = "LORDS"
	FACTIONSYMBOLS_CULT FactionSymbols = "CULT"
	FACTIONSYMBOLS_ANCIENTS FactionSymbols = "ANCIENTS"
	FACTIONSYMBOLS_SHADOW FactionSymbols = "SHADOW"
	FACTIONSYMBOLS_ETHEREAL FactionSymbols = "ETHEREAL"
)

// All allowed values of FactionSymbols enum
var AllowedFactionSymbolsEnumValues = []FactionSymbols{
	"COSMIC",
	"VOID",
	"GALACTIC",
	"QUANTUM",
	"DOMINION",
	"ASTRO",
	"CORSAIRS",
	"OBSIDIAN",
	"AEGIS",
	"UNITED",
	"SOLITARY",
	"COBALT",
	"OMEGA",
	"ECHO",
	"LORDS",
	"CULT",
	"ANCIENTS",
	"SHADOW",
	"ETHEREAL",
}

func (v *FactionSymbols) UnmarshalJSON(src []byte) error {
	var value string
	err := json.Unmarshal(src, &value)
	if err != nil {
		return err
	}
	enumTypeValue := FactionSymbols(value)
	for _, existing := range AllowedFactionSymbolsEnumValues {
		if existing == enumTypeValue {
			*v = enumTypeValue
			return nil
		}
	}

	return fmt.Errorf("%+v is not a valid FactionSymbols", value)
}

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

// IsValid return true if the value is valid for the enum, false otherwise
func (v FactionSymbols) IsValid() bool {
	for _, existing := range AllowedFactionSymbolsEnumValues {
		if existing == v {
			return true
		}
	}
	return false
}

// Ptr returns reference to FactionSymbols value
func (v FactionSymbols) Ptr() *FactionSymbols {
	return &v
}

type NullableFactionSymbols struct {
	value *FactionSymbols
	isSet bool
}

func (v NullableFactionSymbols) Get() *FactionSymbols {
	return v.value
}

func (v *NullableFactionSymbols) Set(val *FactionSymbols) {
	v.value = val
	v.isSet = true
}

func (v NullableFactionSymbols) IsSet() bool {
	return v.isSet
}

func (v *NullableFactionSymbols) Unset() {
	v.value = nil
	v.isSet = false
}

func NewNullableFactionSymbols(val *FactionSymbols) *NullableFactionSymbols {
	return &NullableFactionSymbols{value: val, isSet: true}
}

func (v NullableFactionSymbols) MarshalJSON() ([]byte, error) {
	return json.Marshal(v.value)
}

func (v *NullableFactionSymbols) UnmarshalJSON(src []byte) error {
	v.isSet = true
	return json.Unmarshal(src, &v.value)
}

