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

// checks if the WebhookInitializationStatus type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &WebhookInitializationStatus{}

// WebhookInitializationStatus struct for WebhookInitializationStatus
type WebhookInitializationStatus struct {
	// Organization ID
	OrganizationId string `json:"organizationId"`
	// The ID of the Svix application
	SvixApplicationId NullableString `json:"svixApplicationId"`
	// The error reason for the last initialization attempt
	LastError NullableString `json:"lastError"`
	// The number of times the initialization has been attempted
	RetryCount float32 `json:"retryCount"`
	// When the webhook initialization was created
	CreatedAt string `json:"createdAt"`
	// When the webhook initialization was last updated
	UpdatedAt string `json:"updatedAt"`
	AdditionalProperties map[string]interface{}
}

type _WebhookInitializationStatus WebhookInitializationStatus

// NewWebhookInitializationStatus instantiates a new WebhookInitializationStatus object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewWebhookInitializationStatus(organizationId string, svixApplicationId NullableString, lastError NullableString, retryCount float32, createdAt string, updatedAt string) *WebhookInitializationStatus {
	this := WebhookInitializationStatus{}
	this.OrganizationId = organizationId
	this.SvixApplicationId = svixApplicationId
	this.LastError = lastError
	this.RetryCount = retryCount
	this.CreatedAt = createdAt
	this.UpdatedAt = updatedAt
	return &this
}

// NewWebhookInitializationStatusWithDefaults instantiates a new WebhookInitializationStatus object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewWebhookInitializationStatusWithDefaults() *WebhookInitializationStatus {
	this := WebhookInitializationStatus{}
	return &this
}

// GetOrganizationId returns the OrganizationId field value
func (o *WebhookInitializationStatus) GetOrganizationId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.OrganizationId
}

// GetOrganizationIdOk returns a tuple with the OrganizationId field value
// and a boolean to check if the value has been set.
func (o *WebhookInitializationStatus) GetOrganizationIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.OrganizationId, true
}

// SetOrganizationId sets field value
func (o *WebhookInitializationStatus) SetOrganizationId(v string) {
	o.OrganizationId = v
}

// GetSvixApplicationId returns the SvixApplicationId field value
// If the value is explicit nil, the zero value for string will be returned
func (o *WebhookInitializationStatus) GetSvixApplicationId() string {
	if o == nil || o.SvixApplicationId.Get() == nil {
		var ret string
		return ret
	}

	return *o.SvixApplicationId.Get()
}

// GetSvixApplicationIdOk returns a tuple with the SvixApplicationId field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *WebhookInitializationStatus) GetSvixApplicationIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.SvixApplicationId.Get(), o.SvixApplicationId.IsSet()
}

// SetSvixApplicationId sets field value
func (o *WebhookInitializationStatus) SetSvixApplicationId(v string) {
	o.SvixApplicationId.Set(&v)
}

// GetLastError returns the LastError field value
// If the value is explicit nil, the zero value for string will be returned
func (o *WebhookInitializationStatus) GetLastError() string {
	if o == nil || o.LastError.Get() == nil {
		var ret string
		return ret
	}

	return *o.LastError.Get()
}

// GetLastErrorOk returns a tuple with the LastError field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *WebhookInitializationStatus) GetLastErrorOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.LastError.Get(), o.LastError.IsSet()
}

// SetLastError sets field value
func (o *WebhookInitializationStatus) SetLastError(v string) {
	o.LastError.Set(&v)
}

// GetRetryCount returns the RetryCount field value
func (o *WebhookInitializationStatus) GetRetryCount() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.RetryCount
}

// GetRetryCountOk returns a tuple with the RetryCount field value
// and a boolean to check if the value has been set.
func (o *WebhookInitializationStatus) GetRetryCountOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.RetryCount, true
}

// SetRetryCount sets field value
func (o *WebhookInitializationStatus) SetRetryCount(v float32) {
	o.RetryCount = v
}

// GetCreatedAt returns the CreatedAt field value
func (o *WebhookInitializationStatus) GetCreatedAt() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.CreatedAt
}

// GetCreatedAtOk returns a tuple with the CreatedAt field value
// and a boolean to check if the value has been set.
func (o *WebhookInitializationStatus) GetCreatedAtOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.CreatedAt, true
}

// SetCreatedAt sets field value
func (o *WebhookInitializationStatus) SetCreatedAt(v string) {
	o.CreatedAt = v
}

// GetUpdatedAt returns the UpdatedAt field value
func (o *WebhookInitializationStatus) GetUpdatedAt() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.UpdatedAt
}

// GetUpdatedAtOk returns a tuple with the UpdatedAt field value
// and a boolean to check if the value has been set.
func (o *WebhookInitializationStatus) GetUpdatedAtOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.UpdatedAt, true
}

// SetUpdatedAt sets field value
func (o *WebhookInitializationStatus) SetUpdatedAt(v string) {
	o.UpdatedAt = v
}

func (o WebhookInitializationStatus) MarshalJSON() ([]byte, error) {
	toSerialize,err := o.ToMap()
	if err != nil {
		return []byte{}, err
	}
	return json.Marshal(toSerialize)
}

func (o WebhookInitializationStatus) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["organizationId"] = o.OrganizationId
	toSerialize["svixApplicationId"] = o.SvixApplicationId.Get()
	toSerialize["lastError"] = o.LastError.Get()
	toSerialize["retryCount"] = o.RetryCount
	toSerialize["createdAt"] = o.CreatedAt
	toSerialize["updatedAt"] = o.UpdatedAt

	for key, value := range o.AdditionalProperties {
		toSerialize[key] = value
	}

	return toSerialize, nil
}

func (o *WebhookInitializationStatus) UnmarshalJSON(data []byte) (err error) {
	// This validates that all required properties are included in the JSON object
	// by unmarshalling the object into a generic map with string keys and checking
	// that every required field exists as a key in the generic map.
	requiredProperties := []string{
		"organizationId",
		"svixApplicationId",
		"lastError",
		"retryCount",
		"createdAt",
		"updatedAt",
	}

	allProperties := make(map[string]interface{})

	err = json.Unmarshal(data, &allProperties)

	if err != nil {
		return err;
	}

	for _, requiredProperty := range(requiredProperties) {
		if _, exists := allProperties[requiredProperty]; !exists {
			return fmt.Errorf("no value given for required property %v", requiredProperty)
		}
	}

	varWebhookInitializationStatus := _WebhookInitializationStatus{}

	err = json.Unmarshal(data, &varWebhookInitializationStatus)

	if err != nil {
		return err
	}

	*o = WebhookInitializationStatus(varWebhookInitializationStatus)

	additionalProperties := make(map[string]interface{})

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "organizationId")
		delete(additionalProperties, "svixApplicationId")
		delete(additionalProperties, "lastError")
		delete(additionalProperties, "retryCount")
		delete(additionalProperties, "createdAt")
		delete(additionalProperties, "updatedAt")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableWebhookInitializationStatus struct {
	value *WebhookInitializationStatus
	isSet bool
}

func (v NullableWebhookInitializationStatus) Get() *WebhookInitializationStatus {
	return v.value
}

func (v *NullableWebhookInitializationStatus) Set(val *WebhookInitializationStatus) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableWebhookInitializationStatus(val *WebhookInitializationStatus) *NullableWebhookInitializationStatus {
	return &NullableWebhookInitializationStatus{value: val, isSet: true}
}

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

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


