/*
Balance webhook

API version: 1
*/

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

package balancewebhook

import (
	"encoding/json"

	"github.com/adyen/adyen-go-api-library/v21/src/common"
)

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

// Balances struct for Balances
type Balances struct {
	// The balance that is available for use.
	Available *int64 `json:"available,omitempty"`
	// The sum of transactions that have already been settled.
	Balance *int64 `json:"balance,omitempty"`
	// The sum of transactions that will be settled in the future.
	Pending *int64 `json:"pending,omitempty"`
	// The balance currently held in reserve.
	Reserved *int64 `json:"reserved,omitempty"`
}

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

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

// GetAvailable returns the Available field value if set, zero value otherwise.
func (o *Balances) GetAvailable() int64 {
	if o == nil || common.IsNil(o.Available) {
		var ret int64
		return ret
	}
	return *o.Available
}

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

// HasAvailable returns a boolean if a field has been set.
func (o *Balances) HasAvailable() bool {
	if o != nil && !common.IsNil(o.Available) {
		return true
	}

	return false
}

// SetAvailable gets a reference to the given int64 and assigns it to the Available field.
func (o *Balances) SetAvailable(v int64) {
	o.Available = &v
}

// GetBalance returns the Balance field value if set, zero value otherwise.
func (o *Balances) GetBalance() int64 {
	if o == nil || common.IsNil(o.Balance) {
		var ret int64
		return ret
	}
	return *o.Balance
}

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

// HasBalance returns a boolean if a field has been set.
func (o *Balances) HasBalance() bool {
	if o != nil && !common.IsNil(o.Balance) {
		return true
	}

	return false
}

// SetBalance gets a reference to the given int64 and assigns it to the Balance field.
func (o *Balances) SetBalance(v int64) {
	o.Balance = &v
}

// GetPending returns the Pending field value if set, zero value otherwise.
func (o *Balances) GetPending() int64 {
	if o == nil || common.IsNil(o.Pending) {
		var ret int64
		return ret
	}
	return *o.Pending
}

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

// HasPending returns a boolean if a field has been set.
func (o *Balances) HasPending() bool {
	if o != nil && !common.IsNil(o.Pending) {
		return true
	}

	return false
}

// SetPending gets a reference to the given int64 and assigns it to the Pending field.
func (o *Balances) SetPending(v int64) {
	o.Pending = &v
}

// GetReserved returns the Reserved field value if set, zero value otherwise.
func (o *Balances) GetReserved() int64 {
	if o == nil || common.IsNil(o.Reserved) {
		var ret int64
		return ret
	}
	return *o.Reserved
}

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

// HasReserved returns a boolean if a field has been set.
func (o *Balances) HasReserved() bool {
	if o != nil && !common.IsNil(o.Reserved) {
		return true
	}

	return false
}

// SetReserved gets a reference to the given int64 and assigns it to the Reserved field.
func (o *Balances) SetReserved(v int64) {
	o.Reserved = &v
}

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

func (o Balances) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !common.IsNil(o.Available) {
		toSerialize["available"] = o.Available
	}
	if !common.IsNil(o.Balance) {
		toSerialize["balance"] = o.Balance
	}
	if !common.IsNil(o.Pending) {
		toSerialize["pending"] = o.Pending
	}
	if !common.IsNil(o.Reserved) {
		toSerialize["reserved"] = o.Reserved
	}
	return toSerialize, nil
}

type NullableBalances struct {
	value *Balances
	isSet bool
}

func (v NullableBalances) Get() *Balances {
	return v.value
}

func (v *NullableBalances) Set(val *Balances) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableBalances(val *Balances) *NullableBalances {
	return &NullableBalances{value: val, isSet: true}
}

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

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