/*
FinFeedAPI SEC REST API

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

API version: v1
Contact: support@apibricks.io
*/

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

package openapi

import (
	"encoding/json"
	"fmt"
)

// DTOExtractorType the model 'DTOExtractorType'
type DTOExtractorType string

// List of DTO.ExtractorType
const (
	TEXT DTOExtractorType = "text"
	HTML DTOExtractorType = "html"
)

// All allowed values of DTOExtractorType enum
var AllowedDTOExtractorTypeEnumValues = []DTOExtractorType{
	"text",
	"html",
}

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

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

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

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

// Ptr returns reference to DTO.ExtractorType value
func (v DTOExtractorType) Ptr() *DTOExtractorType {
	return &v
}

type NullableDTOExtractorType struct {
	value *DTOExtractorType
	isSet bool
}

func (v NullableDTOExtractorType) Get() *DTOExtractorType {
	return v.value
}

func (v *NullableDTOExtractorType) Set(val *DTOExtractorType) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDTOExtractorType(val *DTOExtractorType) *NullableDTOExtractorType {
	return &NullableDTOExtractorType{value: val, isSet: true}
}

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

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

