/*
Hindsight HTTP API

HTTP API for Hindsight

API version: 0.5.3
*/

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

package hindsight

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

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

// ConsolidationResponse Response model for consolidation trigger endpoint.
type ConsolidationResponse struct {
	// ID of the async consolidation operation
	OperationId string `json:"operation_id"`
	// True if an existing pending task was reused
	Deduplicated *bool `json:"deduplicated,omitempty"`
}

type _ConsolidationResponse ConsolidationResponse

// NewConsolidationResponse instantiates a new ConsolidationResponse 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 NewConsolidationResponse(operationId string) *ConsolidationResponse {
	this := ConsolidationResponse{}
	this.OperationId = operationId
	var deduplicated bool = false
	this.Deduplicated = &deduplicated
	return &this
}

// NewConsolidationResponseWithDefaults instantiates a new ConsolidationResponse 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 NewConsolidationResponseWithDefaults() *ConsolidationResponse {
	this := ConsolidationResponse{}
	var deduplicated bool = false
	this.Deduplicated = &deduplicated
	return &this
}

// GetOperationId returns the OperationId field value
func (o *ConsolidationResponse) GetOperationId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.OperationId
}

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

// SetOperationId sets field value
func (o *ConsolidationResponse) SetOperationId(v string) {
	o.OperationId = v
}

// GetDeduplicated returns the Deduplicated field value if set, zero value otherwise.
func (o *ConsolidationResponse) GetDeduplicated() bool {
	if o == nil || IsNil(o.Deduplicated) {
		var ret bool
		return ret
	}
	return *o.Deduplicated
}

// GetDeduplicatedOk returns a tuple with the Deduplicated field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ConsolidationResponse) GetDeduplicatedOk() (*bool, bool) {
	if o == nil || IsNil(o.Deduplicated) {
		return nil, false
	}
	return o.Deduplicated, true
}

// HasDeduplicated returns a boolean if a field has been set.
func (o *ConsolidationResponse) HasDeduplicated() bool {
	if o != nil && !IsNil(o.Deduplicated) {
		return true
	}

	return false
}

// SetDeduplicated gets a reference to the given bool and assigns it to the Deduplicated field.
func (o *ConsolidationResponse) SetDeduplicated(v bool) {
	o.Deduplicated = &v
}

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

func (o ConsolidationResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["operation_id"] = o.OperationId
	if !IsNil(o.Deduplicated) {
		toSerialize["deduplicated"] = o.Deduplicated
	}
	return toSerialize, nil
}

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

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

	varConsolidationResponse := _ConsolidationResponse{}

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

	if err != nil {
		return err
	}

	*o = ConsolidationResponse(varConsolidationResponse)

	return err
}

type NullableConsolidationResponse struct {
	value *ConsolidationResponse
	isSet bool
}

func (v NullableConsolidationResponse) Get() *ConsolidationResponse {
	return v.value
}

func (v *NullableConsolidationResponse) Set(val *ConsolidationResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableConsolidationResponse(val *ConsolidationResponse) *NullableConsolidationResponse {
	return &NullableConsolidationResponse{value: val, isSet: true}
}

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

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


