/*
 * Subset of Influx API covered by Influx CLI
 *
 * 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 api

import (
	"encoding/json"
	"fmt"
)

// ColumnDataType the model 'ColumnDataType'
type ColumnDataType string

// List of ColumnDataType
const (
	COLUMNDATATYPE_INTEGER  ColumnDataType = "integer"
	COLUMNDATATYPE_FLOAT    ColumnDataType = "float"
	COLUMNDATATYPE_BOOLEAN  ColumnDataType = "boolean"
	COLUMNDATATYPE_STRING   ColumnDataType = "string"
	COLUMNDATATYPE_UNSIGNED ColumnDataType = "unsigned"
)

func ColumnDataTypeValues() []ColumnDataType {
	return []ColumnDataType{"integer", "float", "boolean", "string", "unsigned"}
}

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

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

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

type NullableColumnDataType struct {
	value *ColumnDataType
	isSet bool
}

func (v NullableColumnDataType) Get() *ColumnDataType {
	return v.value
}

func (v *NullableColumnDataType) Set(val *ColumnDataType) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableColumnDataType(val *ColumnDataType) *NullableColumnDataType {
	return &NullableColumnDataType{value: val, isSet: true}
}

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

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