/*
Mender API

Combined API specification for the features of the different Mender backend services, suitable for code generation applications 

API version: 1
Contact: support@mender.io
*/

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

package client

import (
	"encoding/json"
)

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

// PlanBindingDetails Combination of plan and limits objects.
type PlanBindingDetails struct {
	Plan *Plan `json:"plan,omitempty"`
	Limits *PlanLimits `json:"limits,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _PlanBindingDetails PlanBindingDetails

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

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

// GetPlan returns the Plan field value if set, zero value otherwise.
func (o *PlanBindingDetails) GetPlan() Plan {
	if o == nil || IsNil(o.Plan) {
		var ret Plan
		return ret
	}
	return *o.Plan
}

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

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

	return false
}

// SetPlan gets a reference to the given Plan and assigns it to the Plan field.
func (o *PlanBindingDetails) SetPlan(v Plan) {
	o.Plan = &v
}

// GetLimits returns the Limits field value if set, zero value otherwise.
func (o *PlanBindingDetails) GetLimits() PlanLimits {
	if o == nil || IsNil(o.Limits) {
		var ret PlanLimits
		return ret
	}
	return *o.Limits
}

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

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

	return false
}

// SetLimits gets a reference to the given PlanLimits and assigns it to the Limits field.
func (o *PlanBindingDetails) SetLimits(v PlanLimits) {
	o.Limits = &v
}

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

func (o PlanBindingDetails) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Plan) {
		toSerialize["plan"] = o.Plan
	}
	if !IsNil(o.Limits) {
		toSerialize["limits"] = o.Limits
	}

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

	return toSerialize, nil
}

func (o *PlanBindingDetails) UnmarshalJSON(data []byte) (err error) {
	varPlanBindingDetails := _PlanBindingDetails{}

	err = json.Unmarshal(data, &varPlanBindingDetails)

	if err != nil {
		return err
	}

	*o = PlanBindingDetails(varPlanBindingDetails)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "plan")
		delete(additionalProperties, "limits")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullablePlanBindingDetails struct {
	value *PlanBindingDetails
	isSet bool
}

func (v NullablePlanBindingDetails) Get() *PlanBindingDetails {
	return v.value
}

func (v *NullablePlanBindingDetails) Set(val *PlanBindingDetails) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePlanBindingDetails(val *PlanBindingDetails) *NullablePlanBindingDetails {
	return &NullablePlanBindingDetails{value: val, isSet: true}
}

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

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


