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

// WebhookEvent The type of event being sent
type WebhookEvent string

// List of WebhookEvent
const (
	WEBHOOKEVENT_SANDBOX_CREATED WebhookEvent = "sandbox.created"
	WEBHOOKEVENT_SANDBOX_STATE_UPDATED WebhookEvent = "sandbox.state.updated"
	WEBHOOKEVENT_SNAPSHOT_CREATED WebhookEvent = "snapshot.created"
	WEBHOOKEVENT_SNAPSHOT_STATE_UPDATED WebhookEvent = "snapshot.state.updated"
	WEBHOOKEVENT_SNAPSHOT_REMOVED WebhookEvent = "snapshot.removed"
	WEBHOOKEVENT_VOLUME_CREATED WebhookEvent = "volume.created"
	WEBHOOKEVENT_VOLUME_STATE_UPDATED WebhookEvent = "volume.state.updated"
	WEBHOOKEVENT_UNKNOWN_DEFAULT_OPEN_API WebhookEvent = "11184809"
)

// All allowed values of WebhookEvent enum
var AllowedWebhookEventEnumValues = []WebhookEvent{
	"sandbox.created",
	"sandbox.state.updated",
	"snapshot.created",
	"snapshot.state.updated",
	"snapshot.removed",
	"volume.created",
	"volume.state.updated",
	"11184809",
}

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

	*v = WEBHOOKEVENT_UNKNOWN_DEFAULT_OPEN_API
	return nil
}

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

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

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

type NullableWebhookEvent struct {
	value *WebhookEvent
	isSet bool
}

func (v NullableWebhookEvent) Get() *WebhookEvent {
	return v.value
}

func (v *NullableWebhookEvent) Set(val *WebhookEvent) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableWebhookEvent(val *WebhookEvent) *NullableWebhookEvent {
	return &NullableWebhookEvent{value: val, isSet: true}
}

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

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

