/*
Daytona

Daytona AI platform API Docs

API version: 1.0
Contact: support@daytona.com
*/

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

package apiclient

import (
	"encoding/json"
)

// JobStatus the model 'JobStatus'
type JobStatus string

// List of JobStatus
const (
	JOBSTATUS_PENDING JobStatus = "PENDING"
	JOBSTATUS_IN_PROGRESS JobStatus = "IN_PROGRESS"
	JOBSTATUS_COMPLETED JobStatus = "COMPLETED"
	JOBSTATUS_FAILED JobStatus = "FAILED"
	JOBSTATUS_UNKNOWN_DEFAULT_OPEN_API JobStatus = "11184809"
)

// All allowed values of JobStatus enum
var AllowedJobStatusEnumValues = []JobStatus{
	"PENDING",
	"IN_PROGRESS",
	"COMPLETED",
	"FAILED",
	"11184809",
}

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

	*v = JOBSTATUS_UNKNOWN_DEFAULT_OPEN_API
	return nil
}

// NewJobStatusFromValue returns a pointer to a valid JobStatus
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewJobStatusFromValue(v string) (*JobStatus, error) {
	ev := JobStatus(v)
	if ev.IsValid() {
		return &ev, nil
	} else {
		enumValue := JOBSTATUS_UNKNOWN_DEFAULT_OPEN_API
		return &enumValue, nil
	}
}

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

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

type NullableJobStatus struct {
	value *JobStatus
	isSet bool
}

func (v NullableJobStatus) Get() *JobStatus {
	return v.value
}

func (v *NullableJobStatus) Set(val *JobStatus) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableJobStatus(val *JobStatus) *NullableJobStatus {
	return &NullableJobStatus{value: val, isSet: true}
}

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

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

