/*
Hindsight HTTP API

HTTP API for Hindsight

API version: 0.4.17
*/

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

package hindsight

import (
	"encoding/json"
	"bytes"
	"fmt"
)

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

// WebhookDeliveryListResponse Response model for listing webhook deliveries.
type WebhookDeliveryListResponse struct {
	Items []WebhookDeliveryResponse `json:"items"`
	NextCursor NullableString `json:"next_cursor,omitempty"`
}

type _WebhookDeliveryListResponse WebhookDeliveryListResponse

// NewWebhookDeliveryListResponse instantiates a new WebhookDeliveryListResponse 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 NewWebhookDeliveryListResponse(items []WebhookDeliveryResponse) *WebhookDeliveryListResponse {
	this := WebhookDeliveryListResponse{}
	this.Items = items
	return &this
}

// NewWebhookDeliveryListResponseWithDefaults instantiates a new WebhookDeliveryListResponse 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 NewWebhookDeliveryListResponseWithDefaults() *WebhookDeliveryListResponse {
	this := WebhookDeliveryListResponse{}
	return &this
}

// GetItems returns the Items field value
func (o *WebhookDeliveryListResponse) GetItems() []WebhookDeliveryResponse {
	if o == nil {
		var ret []WebhookDeliveryResponse
		return ret
	}

	return o.Items
}

// GetItemsOk returns a tuple with the Items field value
// and a boolean to check if the value has been set.
func (o *WebhookDeliveryListResponse) GetItemsOk() ([]WebhookDeliveryResponse, bool) {
	if o == nil {
		return nil, false
	}
	return o.Items, true
}

// SetItems sets field value
func (o *WebhookDeliveryListResponse) SetItems(v []WebhookDeliveryResponse) {
	o.Items = v
}

// GetNextCursor returns the NextCursor field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *WebhookDeliveryListResponse) GetNextCursor() string {
	if o == nil || IsNil(o.NextCursor.Get()) {
		var ret string
		return ret
	}
	return *o.NextCursor.Get()
}

// GetNextCursorOk returns a tuple with the NextCursor field value if set, nil otherwise
// 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 *WebhookDeliveryListResponse) GetNextCursorOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.NextCursor.Get(), o.NextCursor.IsSet()
}

// HasNextCursor returns a boolean if a field has been set.
func (o *WebhookDeliveryListResponse) HasNextCursor() bool {
	if o != nil && o.NextCursor.IsSet() {
		return true
	}

	return false
}

// SetNextCursor gets a reference to the given NullableString and assigns it to the NextCursor field.
func (o *WebhookDeliveryListResponse) SetNextCursor(v string) {
	o.NextCursor.Set(&v)
}
// SetNextCursorNil sets the value for NextCursor to be an explicit nil
func (o *WebhookDeliveryListResponse) SetNextCursorNil() {
	o.NextCursor.Set(nil)
}

// UnsetNextCursor ensures that no value is present for NextCursor, not even an explicit nil
func (o *WebhookDeliveryListResponse) UnsetNextCursor() {
	o.NextCursor.Unset()
}

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

func (o WebhookDeliveryListResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["items"] = o.Items
	if o.NextCursor.IsSet() {
		toSerialize["next_cursor"] = o.NextCursor.Get()
	}
	return toSerialize, nil
}

func (o *WebhookDeliveryListResponse) 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{
		"items",
	}

	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)
		}
	}

	varWebhookDeliveryListResponse := _WebhookDeliveryListResponse{}

	decoder := json.NewDecoder(bytes.NewReader(data))
	decoder.DisallowUnknownFields()
	err = decoder.Decode(&varWebhookDeliveryListResponse)

	if err != nil {
		return err
	}

	*o = WebhookDeliveryListResponse(varWebhookDeliveryListResponse)

	return err
}

type NullableWebhookDeliveryListResponse struct {
	value *WebhookDeliveryListResponse
	isSet bool
}

func (v NullableWebhookDeliveryListResponse) Get() *WebhookDeliveryListResponse {
	return v.value
}

func (v *NullableWebhookDeliveryListResponse) Set(val *WebhookDeliveryListResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableWebhookDeliveryListResponse(val *WebhookDeliveryListResponse) *NullableWebhookDeliveryListResponse {
	return &NullableWebhookDeliveryListResponse{value: val, isSet: true}
}

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

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


