/*
EMS - REST API

This section will provide necessary information about the `CoinAPI EMS REST API` protocol. This API is also available in the Postman application: <a href=\"https://postman.coinapi.io/\" target=\"_blank\">https://postman.coinapi.io/</a>        Implemented Standards:    * [HTTP1.0](https://datatracker.ietf.org/doc/html/rfc1945)   * [HTTP1.1](https://datatracker.ietf.org/doc/html/rfc2616)   * [HTTP2.0](https://datatracker.ietf.org/doc/html/rfc7540)     ### Endpoints  <table>   <thead>     <tr>       <th>Deployment method</th>       <th>Environment</th>       <th>Url</th>     </tr>   </thead>   <tbody>     <tr>       <td>Managed Cloud</td>       <td>Production</td>       <td>Use <a href=\"#ems-docs-sh\">Managed Cloud REST API /v1/locations</a> to get specific endpoints to each server site where your deployments span</td>     </tr>     <tr>       <td>Self Hosted</td>       <td>Production</td>       <td>IP Address of the <code>ems-gateway</code> container/excecutable in the closest server site to the caller location</td>     </tr>   </tbody> </table>  ### Authentication If the software is deployed as `Self-Hosted` then API do not require authentication as inside your infrastructure, your company is responsible for the security and access controls.  If the software is deployed in our `Managed Cloud`, there are 2 methods for authenticating with us, you only need to use one:   1. Custom authorization header named `X-CoinAPI-Key` with the API Key  2. Query string parameter named `apikey` with the API Key  3. <a href=\"#certificate\">TLS Client Certificate</a> from the `Managed Cloud REST API` (/v1/certificate/pem endpoint) while establishing a TLS session with us.  #### Custom authorization header You can authorize by providing additional custom header named `X-CoinAPI-Key` and API key as its value. Assuming that your API key is `73034021-THIS-IS-SAMPLE-KEY`, then the authorization header you should send to us will look like: `X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY` <aside class=\"success\">This method is recommended by us and you should use it in production environments.</aside> #### Query string authorization parameter You can authorize by providing an additional parameter named `apikey` with a value equal to your API key in the query string of your HTTP request. Assuming that your API key is `73034021-THIS-IS-SAMPLE-KEY` and that you want to request all balances, then your query string should look like this: `GET /v1/balances?apikey=73034021-THIS-IS-SAMPLE-KEY` <aside class=\"notice\">Query string method may be more practical for development activities.</aside> 

API version: v1
Contact: support@coinapi.io
*/

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

package openapi

import (
	"encoding/json"
)

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

// BalanceDataInner struct for BalanceDataInner
type BalanceDataInner struct {
	// Exchange currency code.
	AssetIdExchange *string `json:"asset_id_exchange,omitempty"`
	// CoinAPI currency code.
	AssetIdCoinapi *string `json:"asset_id_coinapi,omitempty"`
	// Value of the current total currency balance on the exchange.
	Balance *float64 `json:"balance,omitempty"`
	// Value of the current available currency balance on the exchange that can be used as collateral.
	Available *float64 `json:"available,omitempty"`
	// Value of the current locked currency balance by the exchange.
	Locked *float64 `json:"locked,omitempty"`
	// Source of the last modification. 
	LastUpdatedBy *string `json:"last_updated_by,omitempty"`
	// Current exchange rate to the USD for the single unit of the currency. 
	RateUsd *float64 `json:"rate_usd,omitempty"`
	// Value of the current total traded.
	Traded *float64 `json:"traded,omitempty"`
}

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

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

// GetAssetIdExchange returns the AssetIdExchange field value if set, zero value otherwise.
func (o *BalanceDataInner) GetAssetIdExchange() string {
	if o == nil || IsNil(o.AssetIdExchange) {
		var ret string
		return ret
	}
	return *o.AssetIdExchange
}

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

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

	return false
}

// SetAssetIdExchange gets a reference to the given string and assigns it to the AssetIdExchange field.
func (o *BalanceDataInner) SetAssetIdExchange(v string) {
	o.AssetIdExchange = &v
}

// GetAssetIdCoinapi returns the AssetIdCoinapi field value if set, zero value otherwise.
func (o *BalanceDataInner) GetAssetIdCoinapi() string {
	if o == nil || IsNil(o.AssetIdCoinapi) {
		var ret string
		return ret
	}
	return *o.AssetIdCoinapi
}

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

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

	return false
}

// SetAssetIdCoinapi gets a reference to the given string and assigns it to the AssetIdCoinapi field.
func (o *BalanceDataInner) SetAssetIdCoinapi(v string) {
	o.AssetIdCoinapi = &v
}

// GetBalance returns the Balance field value if set, zero value otherwise.
func (o *BalanceDataInner) GetBalance() float64 {
	if o == nil || IsNil(o.Balance) {
		var ret float64
		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 *BalanceDataInner) GetBalanceOk() (*float64, bool) {
	if o == nil || IsNil(o.Balance) {
		return nil, false
	}
	return o.Balance, true
}

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

	return false
}

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

// GetAvailable returns the Available field value if set, zero value otherwise.
func (o *BalanceDataInner) GetAvailable() float64 {
	if o == nil || IsNil(o.Available) {
		var ret float64
		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 *BalanceDataInner) GetAvailableOk() (*float64, bool) {
	if o == nil || IsNil(o.Available) {
		return nil, false
	}
	return o.Available, true
}

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

	return false
}

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

// GetLocked returns the Locked field value if set, zero value otherwise.
func (o *BalanceDataInner) GetLocked() float64 {
	if o == nil || IsNil(o.Locked) {
		var ret float64
		return ret
	}
	return *o.Locked
}

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

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

	return false
}

// SetLocked gets a reference to the given float64 and assigns it to the Locked field.
func (o *BalanceDataInner) SetLocked(v float64) {
	o.Locked = &v
}

// GetLastUpdatedBy returns the LastUpdatedBy field value if set, zero value otherwise.
func (o *BalanceDataInner) GetLastUpdatedBy() string {
	if o == nil || IsNil(o.LastUpdatedBy) {
		var ret string
		return ret
	}
	return *o.LastUpdatedBy
}

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

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

	return false
}

// SetLastUpdatedBy gets a reference to the given string and assigns it to the LastUpdatedBy field.
func (o *BalanceDataInner) SetLastUpdatedBy(v string) {
	o.LastUpdatedBy = &v
}

// GetRateUsd returns the RateUsd field value if set, zero value otherwise.
func (o *BalanceDataInner) GetRateUsd() float64 {
	if o == nil || IsNil(o.RateUsd) {
		var ret float64
		return ret
	}
	return *o.RateUsd
}

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

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

	return false
}

// SetRateUsd gets a reference to the given float64 and assigns it to the RateUsd field.
func (o *BalanceDataInner) SetRateUsd(v float64) {
	o.RateUsd = &v
}

// GetTraded returns the Traded field value if set, zero value otherwise.
func (o *BalanceDataInner) GetTraded() float64 {
	if o == nil || IsNil(o.Traded) {
		var ret float64
		return ret
	}
	return *o.Traded
}

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

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

	return false
}

// SetTraded gets a reference to the given float64 and assigns it to the Traded field.
func (o *BalanceDataInner) SetTraded(v float64) {
	o.Traded = &v
}

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

func (o BalanceDataInner) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.AssetIdExchange) {
		toSerialize["asset_id_exchange"] = o.AssetIdExchange
	}
	if !IsNil(o.AssetIdCoinapi) {
		toSerialize["asset_id_coinapi"] = o.AssetIdCoinapi
	}
	if !IsNil(o.Balance) {
		toSerialize["balance"] = o.Balance
	}
	if !IsNil(o.Available) {
		toSerialize["available"] = o.Available
	}
	if !IsNil(o.Locked) {
		toSerialize["locked"] = o.Locked
	}
	if !IsNil(o.LastUpdatedBy) {
		toSerialize["last_updated_by"] = o.LastUpdatedBy
	}
	if !IsNil(o.RateUsd) {
		toSerialize["rate_usd"] = o.RateUsd
	}
	if !IsNil(o.Traded) {
		toSerialize["traded"] = o.Traded
	}
	return toSerialize, nil
}

type NullableBalanceDataInner struct {
	value *BalanceDataInner
	isSet bool
}

func (v NullableBalanceDataInner) Get() *BalanceDataInner {
	return v.value
}

func (v *NullableBalanceDataInner) Set(val *BalanceDataInner) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableBalanceDataInner(val *BalanceDataInner) *NullableBalanceDataInner {
	return &NullableBalanceDataInner{value: val, isSet: true}
}

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

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


