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

// TaskStatusType `inactive` cancels scheduled runs and prevents manual runs of the task.
type TaskStatusType string

// List of TaskStatusType
const (
	TASKSTATUSTYPE_ACTIVE   TaskStatusType = "active"
	TASKSTATUSTYPE_INACTIVE TaskStatusType = "inactive"
)

func TaskStatusTypeValues() []TaskStatusType {
	return []TaskStatusType{"active", "inactive"}
}

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

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

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

type NullableTaskStatusType struct {
	value *TaskStatusType
	isSet bool
}

func (v NullableTaskStatusType) Get() *TaskStatusType {
	return v.value
}

func (v *NullableTaskStatusType) Set(val *TaskStatusType) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableTaskStatusType(val *TaskStatusType) *NullableTaskStatusType {
	return &NullableTaskStatusType{value: val, isSet: true}
}

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

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