// Code generated by go-swagger; DO NOT EDIT.

package models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"
	"encoding/json"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/validate"
)

// CommonRegion - EU868: EU868
//   - US915: US915
//   - CN779: CN779
//   - EU433: EU433
//   - AU915: AU915
//   - CN470: CN470
//   - AS923: AS923
//   - AS923_2: AS923 with -1.80 MHz frequency offset
//   - AS923_3: AS923 with -6.60 MHz frequency offset
//   - AS923_4: (AS923 with -5.90 MHz frequency offset).
//   - KR920: KR920
//   - IN865: IN865
//   - RU864: RU864
//   - ISM2400: ISM2400 (LoRaWAN 2.4 GHz)
//
// swagger:model commonRegion
type CommonRegion string

func NewCommonRegion(value CommonRegion) *CommonRegion {
	return &value
}

// Pointer returns a pointer to a freshly-allocated CommonRegion.
func (m CommonRegion) Pointer() *CommonRegion {
	return &m
}

const (

	// CommonRegionEU868 captures enum value "EU868"
	CommonRegionEU868 CommonRegion = "EU868"

	// CommonRegionUS915 captures enum value "US915"
	CommonRegionUS915 CommonRegion = "US915"

	// CommonRegionCN779 captures enum value "CN779"
	CommonRegionCN779 CommonRegion = "CN779"

	// CommonRegionEU433 captures enum value "EU433"
	CommonRegionEU433 CommonRegion = "EU433"

	// CommonRegionAU915 captures enum value "AU915"
	CommonRegionAU915 CommonRegion = "AU915"

	// CommonRegionCN470 captures enum value "CN470"
	CommonRegionCN470 CommonRegion = "CN470"

	// CommonRegionAS923 captures enum value "AS923"
	CommonRegionAS923 CommonRegion = "AS923"

	// CommonRegionAS9232 captures enum value "AS923_2"
	CommonRegionAS9232 CommonRegion = "AS923_2"

	// CommonRegionAS9233 captures enum value "AS923_3"
	CommonRegionAS9233 CommonRegion = "AS923_3"

	// CommonRegionAS9234 captures enum value "AS923_4"
	CommonRegionAS9234 CommonRegion = "AS923_4"

	// CommonRegionKR920 captures enum value "KR920"
	CommonRegionKR920 CommonRegion = "KR920"

	// CommonRegionIN865 captures enum value "IN865"
	CommonRegionIN865 CommonRegion = "IN865"

	// CommonRegionRU864 captures enum value "RU864"
	CommonRegionRU864 CommonRegion = "RU864"

	// CommonRegionISM2400 captures enum value "ISM2400"
	CommonRegionISM2400 CommonRegion = "ISM2400"
)

// for schema
var commonRegionEnum []interface{}

func init() {
	var res []CommonRegion
	if err := json.Unmarshal([]byte(`["EU868","US915","CN779","EU433","AU915","CN470","AS923","AS923_2","AS923_3","AS923_4","KR920","IN865","RU864","ISM2400"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		commonRegionEnum = append(commonRegionEnum, v)
	}
}

func (m CommonRegion) validateCommonRegionEnum(path, location string, value CommonRegion) error {
	if err := validate.EnumCase(path, location, value, commonRegionEnum, true); err != nil {
		return err
	}
	return nil
}

// Validate validates this common region
func (m CommonRegion) Validate(formats strfmt.Registry) error {
	var res []error

	// value enum
	if err := m.validateCommonRegionEnum("", "body", m); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

// ContextValidate validates this common region based on context it is used
func (m CommonRegion) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}
