/*
 * Extra configuration to force openapi to generate enum validators
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * API version: 2.0.0
 */

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

package extras

import (
	"encoding/json"
	"fmt"
)

// ResourceEnumOSS The type of resource. In a `permission`, applies the permission to all resources of this type.
type ResourceEnumOSS string

// List of ResourceEnumOSS
const (
	RESOURCEENUMOSS_AUTHORIZATIONS         ResourceEnumOSS = "authorizations"
	RESOURCEENUMOSS_BUCKETS                ResourceEnumOSS = "buckets"
	RESOURCEENUMOSS_DASHBOARDS             ResourceEnumOSS = "dashboards"
	RESOURCEENUMOSS_ORGS                   ResourceEnumOSS = "orgs"
	RESOURCEENUMOSS_TASKS                  ResourceEnumOSS = "tasks"
	RESOURCEENUMOSS_TELEGRAFS              ResourceEnumOSS = "telegrafs"
	RESOURCEENUMOSS_USERS                  ResourceEnumOSS = "users"
	RESOURCEENUMOSS_VARIABLES              ResourceEnumOSS = "variables"
	RESOURCEENUMOSS_SECRETS                ResourceEnumOSS = "secrets"
	RESOURCEENUMOSS_LABELS                 ResourceEnumOSS = "labels"
	RESOURCEENUMOSS_VIEWS                  ResourceEnumOSS = "views"
	RESOURCEENUMOSS_DOCUMENTS              ResourceEnumOSS = "documents"
	RESOURCEENUMOSS_NOTIFICATION_RULES     ResourceEnumOSS = "notificationRules"
	RESOURCEENUMOSS_NOTIFICATION_ENDPOINTS ResourceEnumOSS = "notificationEndpoints"
	RESOURCEENUMOSS_CHECKS                 ResourceEnumOSS = "checks"
	RESOURCEENUMOSS_DBRP                   ResourceEnumOSS = "dbrp"
	RESOURCEENUMOSS_ANNOTATIONS            ResourceEnumOSS = "annotations"
	RESOURCEENUMOSS_SOURCES                ResourceEnumOSS = "sources"
	RESOURCEENUMOSS_SCRAPERS               ResourceEnumOSS = "scrapers"
	RESOURCEENUMOSS_NOTEBOOKS              ResourceEnumOSS = "notebooks"
	RESOURCEENUMOSS_REMOTES                ResourceEnumOSS = "remotes"
	RESOURCEENUMOSS_REPLICATIONS           ResourceEnumOSS = "replications"
	RESOURCEENUMOSS_INSTANCE               ResourceEnumOSS = "instance"
)

func ResourceEnumOSSValues() []ResourceEnumOSS {
	return []ResourceEnumOSS{"authorizations", "buckets", "dashboards", "orgs", "tasks", "telegrafs", "users", "variables", "secrets", "labels", "views", "documents", "notificationRules", "notificationEndpoints", "checks", "dbrp", "annotations", "sources", "scrapers", "notebooks", "remotes", "replications", "instance"}
}

func (v *ResourceEnumOSS) UnmarshalJSON(src []byte) error {
	var value string
	err := json.Unmarshal(src, &value)
	if err != nil {
		return err
	}
	enumTypeValue := ResourceEnumOSS(value)
	for _, existing := range []ResourceEnumOSS{"authorizations", "buckets", "dashboards", "orgs", "tasks", "telegrafs", "users", "variables", "secrets", "labels", "views", "documents", "notificationRules", "notificationEndpoints", "checks", "dbrp", "annotations", "sources", "scrapers", "notebooks", "remotes", "replications", "instance"} {
		if existing == enumTypeValue {
			*v = enumTypeValue
			return nil
		}
	}

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

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

type NullableResourceEnumOSS struct {
	value *ResourceEnumOSS
	isSet bool
}

func (v NullableResourceEnumOSS) Get() *ResourceEnumOSS {
	return v.value
}

func (v *NullableResourceEnumOSS) Set(val *ResourceEnumOSS) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableResourceEnumOSS(val *ResourceEnumOSS) *NullableResourceEnumOSS {
	return &NullableResourceEnumOSS{value: val, isSet: true}
}

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

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