/*
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 WebhookDeliveryResponse type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &WebhookDeliveryResponse{}

// WebhookDeliveryResponse Response model for a webhook delivery record.
type WebhookDeliveryResponse struct {
	Id string `json:"id"`
	WebhookId NullableString `json:"webhook_id"`
	Url string `json:"url"`
	EventType string `json:"event_type"`
	Status string `json:"status"`
	Attempts int32 `json:"attempts"`
	NextRetryAt NullableString `json:"next_retry_at,omitempty"`
	LastError NullableString `json:"last_error,omitempty"`
	LastResponseStatus NullableInt32 `json:"last_response_status,omitempty"`
	LastResponseBody NullableString `json:"last_response_body,omitempty"`
	LastAttemptAt NullableString `json:"last_attempt_at,omitempty"`
	CreatedAt NullableString `json:"created_at,omitempty"`
	UpdatedAt NullableString `json:"updated_at,omitempty"`
}

type _WebhookDeliveryResponse WebhookDeliveryResponse

// NewWebhookDeliveryResponse instantiates a new WebhookDeliveryResponse 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 NewWebhookDeliveryResponse(id string, webhookId NullableString, url string, eventType string, status string, attempts int32) *WebhookDeliveryResponse {
	this := WebhookDeliveryResponse{}
	this.Id = id
	this.WebhookId = webhookId
	this.Url = url
	this.EventType = eventType
	this.Status = status
	this.Attempts = attempts
	return &this
}

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

// GetId returns the Id field value
func (o *WebhookDeliveryResponse) GetId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Id
}

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

// SetId sets field value
func (o *WebhookDeliveryResponse) SetId(v string) {
	o.Id = v
}

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

	return *o.WebhookId.Get()
}

// GetWebhookIdOk returns a tuple with the WebhookId 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 *WebhookDeliveryResponse) GetWebhookIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.WebhookId.Get(), o.WebhookId.IsSet()
}

// SetWebhookId sets field value
func (o *WebhookDeliveryResponse) SetWebhookId(v string) {
	o.WebhookId.Set(&v)
}

// GetUrl returns the Url field value
func (o *WebhookDeliveryResponse) GetUrl() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Url
}

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

// SetUrl sets field value
func (o *WebhookDeliveryResponse) SetUrl(v string) {
	o.Url = v
}

// GetEventType returns the EventType field value
func (o *WebhookDeliveryResponse) GetEventType() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.EventType
}

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

// SetEventType sets field value
func (o *WebhookDeliveryResponse) SetEventType(v string) {
	o.EventType = v
}

// GetStatus returns the Status field value
func (o *WebhookDeliveryResponse) GetStatus() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Status
}

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

// SetStatus sets field value
func (o *WebhookDeliveryResponse) SetStatus(v string) {
	o.Status = v
}

// GetAttempts returns the Attempts field value
func (o *WebhookDeliveryResponse) GetAttempts() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.Attempts
}

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

// SetAttempts sets field value
func (o *WebhookDeliveryResponse) SetAttempts(v int32) {
	o.Attempts = v
}

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

// GetNextRetryAtOk returns a tuple with the NextRetryAt 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 *WebhookDeliveryResponse) GetNextRetryAtOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.NextRetryAt.Get(), o.NextRetryAt.IsSet()
}

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

	return false
}

// SetNextRetryAt gets a reference to the given NullableString and assigns it to the NextRetryAt field.
func (o *WebhookDeliveryResponse) SetNextRetryAt(v string) {
	o.NextRetryAt.Set(&v)
}
// SetNextRetryAtNil sets the value for NextRetryAt to be an explicit nil
func (o *WebhookDeliveryResponse) SetNextRetryAtNil() {
	o.NextRetryAt.Set(nil)
}

// UnsetNextRetryAt ensures that no value is present for NextRetryAt, not even an explicit nil
func (o *WebhookDeliveryResponse) UnsetNextRetryAt() {
	o.NextRetryAt.Unset()
}

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

// GetLastErrorOk returns a tuple with the LastError 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 *WebhookDeliveryResponse) GetLastErrorOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.LastError.Get(), o.LastError.IsSet()
}

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

	return false
}

// SetLastError gets a reference to the given NullableString and assigns it to the LastError field.
func (o *WebhookDeliveryResponse) SetLastError(v string) {
	o.LastError.Set(&v)
}
// SetLastErrorNil sets the value for LastError to be an explicit nil
func (o *WebhookDeliveryResponse) SetLastErrorNil() {
	o.LastError.Set(nil)
}

// UnsetLastError ensures that no value is present for LastError, not even an explicit nil
func (o *WebhookDeliveryResponse) UnsetLastError() {
	o.LastError.Unset()
}

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

// GetLastResponseStatusOk returns a tuple with the LastResponseStatus 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 *WebhookDeliveryResponse) GetLastResponseStatusOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}
	return o.LastResponseStatus.Get(), o.LastResponseStatus.IsSet()
}

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

	return false
}

// SetLastResponseStatus gets a reference to the given NullableInt32 and assigns it to the LastResponseStatus field.
func (o *WebhookDeliveryResponse) SetLastResponseStatus(v int32) {
	o.LastResponseStatus.Set(&v)
}
// SetLastResponseStatusNil sets the value for LastResponseStatus to be an explicit nil
func (o *WebhookDeliveryResponse) SetLastResponseStatusNil() {
	o.LastResponseStatus.Set(nil)
}

// UnsetLastResponseStatus ensures that no value is present for LastResponseStatus, not even an explicit nil
func (o *WebhookDeliveryResponse) UnsetLastResponseStatus() {
	o.LastResponseStatus.Unset()
}

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

// GetLastResponseBodyOk returns a tuple with the LastResponseBody 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 *WebhookDeliveryResponse) GetLastResponseBodyOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.LastResponseBody.Get(), o.LastResponseBody.IsSet()
}

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

	return false
}

// SetLastResponseBody gets a reference to the given NullableString and assigns it to the LastResponseBody field.
func (o *WebhookDeliveryResponse) SetLastResponseBody(v string) {
	o.LastResponseBody.Set(&v)
}
// SetLastResponseBodyNil sets the value for LastResponseBody to be an explicit nil
func (o *WebhookDeliveryResponse) SetLastResponseBodyNil() {
	o.LastResponseBody.Set(nil)
}

// UnsetLastResponseBody ensures that no value is present for LastResponseBody, not even an explicit nil
func (o *WebhookDeliveryResponse) UnsetLastResponseBody() {
	o.LastResponseBody.Unset()
}

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

// GetLastAttemptAtOk returns a tuple with the LastAttemptAt 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 *WebhookDeliveryResponse) GetLastAttemptAtOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.LastAttemptAt.Get(), o.LastAttemptAt.IsSet()
}

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

	return false
}

// SetLastAttemptAt gets a reference to the given NullableString and assigns it to the LastAttemptAt field.
func (o *WebhookDeliveryResponse) SetLastAttemptAt(v string) {
	o.LastAttemptAt.Set(&v)
}
// SetLastAttemptAtNil sets the value for LastAttemptAt to be an explicit nil
func (o *WebhookDeliveryResponse) SetLastAttemptAtNil() {
	o.LastAttemptAt.Set(nil)
}

// UnsetLastAttemptAt ensures that no value is present for LastAttemptAt, not even an explicit nil
func (o *WebhookDeliveryResponse) UnsetLastAttemptAt() {
	o.LastAttemptAt.Unset()
}

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

// GetCreatedAtOk returns a tuple with the CreatedAt 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 *WebhookDeliveryResponse) GetCreatedAtOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.CreatedAt.Get(), o.CreatedAt.IsSet()
}

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

	return false
}

// SetCreatedAt gets a reference to the given NullableString and assigns it to the CreatedAt field.
func (o *WebhookDeliveryResponse) SetCreatedAt(v string) {
	o.CreatedAt.Set(&v)
}
// SetCreatedAtNil sets the value for CreatedAt to be an explicit nil
func (o *WebhookDeliveryResponse) SetCreatedAtNil() {
	o.CreatedAt.Set(nil)
}

// UnsetCreatedAt ensures that no value is present for CreatedAt, not even an explicit nil
func (o *WebhookDeliveryResponse) UnsetCreatedAt() {
	o.CreatedAt.Unset()
}

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

// GetUpdatedAtOk returns a tuple with the UpdatedAt 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 *WebhookDeliveryResponse) GetUpdatedAtOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.UpdatedAt.Get(), o.UpdatedAt.IsSet()
}

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

	return false
}

// SetUpdatedAt gets a reference to the given NullableString and assigns it to the UpdatedAt field.
func (o *WebhookDeliveryResponse) SetUpdatedAt(v string) {
	o.UpdatedAt.Set(&v)
}
// SetUpdatedAtNil sets the value for UpdatedAt to be an explicit nil
func (o *WebhookDeliveryResponse) SetUpdatedAtNil() {
	o.UpdatedAt.Set(nil)
}

// UnsetUpdatedAt ensures that no value is present for UpdatedAt, not even an explicit nil
func (o *WebhookDeliveryResponse) UnsetUpdatedAt() {
	o.UpdatedAt.Unset()
}

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

func (o WebhookDeliveryResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["webhook_id"] = o.WebhookId.Get()
	toSerialize["url"] = o.Url
	toSerialize["event_type"] = o.EventType
	toSerialize["status"] = o.Status
	toSerialize["attempts"] = o.Attempts
	if o.NextRetryAt.IsSet() {
		toSerialize["next_retry_at"] = o.NextRetryAt.Get()
	}
	if o.LastError.IsSet() {
		toSerialize["last_error"] = o.LastError.Get()
	}
	if o.LastResponseStatus.IsSet() {
		toSerialize["last_response_status"] = o.LastResponseStatus.Get()
	}
	if o.LastResponseBody.IsSet() {
		toSerialize["last_response_body"] = o.LastResponseBody.Get()
	}
	if o.LastAttemptAt.IsSet() {
		toSerialize["last_attempt_at"] = o.LastAttemptAt.Get()
	}
	if o.CreatedAt.IsSet() {
		toSerialize["created_at"] = o.CreatedAt.Get()
	}
	if o.UpdatedAt.IsSet() {
		toSerialize["updated_at"] = o.UpdatedAt.Get()
	}
	return toSerialize, nil
}

func (o *WebhookDeliveryResponse) 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{
		"id",
		"webhook_id",
		"url",
		"event_type",
		"status",
		"attempts",
	}

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

	varWebhookDeliveryResponse := _WebhookDeliveryResponse{}

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

	if err != nil {
		return err
	}

	*o = WebhookDeliveryResponse(varWebhookDeliveryResponse)

	return err
}

type NullableWebhookDeliveryResponse struct {
	value *WebhookDeliveryResponse
	isSet bool
}

func (v NullableWebhookDeliveryResponse) Get() *WebhookDeliveryResponse {
	return v.value
}

func (v *NullableWebhookDeliveryResponse) Set(val *WebhookDeliveryResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableWebhookDeliveryResponse(val *WebhookDeliveryResponse) *NullableWebhookDeliveryResponse {
	return &NullableWebhookDeliveryResponse{value: val, isSet: true}
}

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

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


