/*
1Backend

AI-native microservices platform.

API version: 0.8.2
Contact: sales@singulatron.com
*/

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

package openapi

import (
	"encoding/json"
	"fmt"
)

// UserSvcListUsersOrderBy the model 'UserSvcListUsersOrderBy'
type UserSvcListUsersOrderBy string

// List of user_svc.ListUsersOrderBy
const (
	ListUsersOrderByCreatedAt UserSvcListUsersOrderBy = "createdAt"
	ListUsersOrderByUpdatedAt UserSvcListUsersOrderBy = "updatedAt"
)

// All allowed values of UserSvcListUsersOrderBy enum
var AllowedUserSvcListUsersOrderByEnumValues = []UserSvcListUsersOrderBy{
	"createdAt",
	"updatedAt",
}

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

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

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

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

// Ptr returns reference to user_svc.ListUsersOrderBy value
func (v UserSvcListUsersOrderBy) Ptr() *UserSvcListUsersOrderBy {
	return &v
}

type NullableUserSvcListUsersOrderBy struct {
	value *UserSvcListUsersOrderBy
	isSet bool
}

func (v NullableUserSvcListUsersOrderBy) Get() *UserSvcListUsersOrderBy {
	return v.value
}

func (v *NullableUserSvcListUsersOrderBy) Set(val *UserSvcListUsersOrderBy) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableUserSvcListUsersOrderBy(val *UserSvcListUsersOrderBy) *NullableUserSvcListUsersOrderBy {
	return &NullableUserSvcListUsersOrderBy{value: val, isSet: true}
}

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

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

