/*
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"
)

// DTOFilingSortBy Defines sorting options for the filing query.
type DTOFilingSortBy string

// List of DTO.FilingSortBy
const (
	ACCESSION_NUMBER DTOFilingSortBy = "AccessionNumber"
	FILING_DATE DTOFilingSortBy = "FilingDate"
	REPORT_DATE DTOFilingSortBy = "ReportDate"
	ACCEPTANCE_DATE_TIME DTOFilingSortBy = "AcceptanceDateTime"
	SIZE DTOFilingSortBy = "Size"
)

// All allowed values of DTOFilingSortBy enum
var AllowedDTOFilingSortByEnumValues = []DTOFilingSortBy{
	"AccessionNumber",
	"FilingDate",
	"ReportDate",
	"AcceptanceDateTime",
	"Size",
}

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

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

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

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

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

type NullableDTOFilingSortBy struct {
	value *DTOFilingSortBy
	isSet bool
}

func (v NullableDTOFilingSortBy) Get() *DTOFilingSortBy {
	return v.value
}

func (v *NullableDTOFilingSortBy) Set(val *DTOFilingSortBy) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDTOFilingSortBy(val *DTOFilingSortBy) *NullableDTOFilingSortBy {
	return &NullableDTOFilingSortBy{value: val, isSet: true}
}

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

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

