/*
 * Svix API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * API version: 1.1.1
 */

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

package openapi

import (
	"encoding/json"
	"fmt"
)

// Oauth2AuthMethodIn the model 'Oauth2AuthMethodIn'
type Oauth2AuthMethodIn string

// List of Oauth2AuthMethodIn
const (
	OAUTH2AUTHMETHODIN_CLIENT_SECRET_JWT Oauth2AuthMethodIn = "clientSecretJwt"
	OAUTH2AUTHMETHODIN_CLIENT_SECRET_BASIC Oauth2AuthMethodIn = "clientSecretBasic"
	OAUTH2AUTHMETHODIN_CLIENT_SECRET_POST Oauth2AuthMethodIn = "clientSecretPost"
)

var allowedOauth2AuthMethodInEnumValues = []Oauth2AuthMethodIn{
	"clientSecretJwt",
	"clientSecretBasic",
	"clientSecretPost",
}

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

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

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

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

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

type NullableOauth2AuthMethodIn struct {
	value *Oauth2AuthMethodIn
	isSet bool
}

func (v NullableOauth2AuthMethodIn) Get() *Oauth2AuthMethodIn {
	return v.value
}

func (v *NullableOauth2AuthMethodIn) Set(val *Oauth2AuthMethodIn) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableOauth2AuthMethodIn(val *Oauth2AuthMethodIn) *NullableOauth2AuthMethodIn {
	return &NullableOauth2AuthMethodIn{value: val, isSet: true}
}

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

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

