Files
sdk/model_train_live.go

416 lines
11 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
)
// checks if the TrainLive type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TrainLive{}
// TrainLive struct for TrainLive
type TrainLive struct {
Damage *int64 `json:"damage,omitempty"`
DamageRate *float64 `json:"damage_rate,omitempty"`
// Fires counts decisions it answered otherwise than the base would have.
Fires *int64 `json:"fires,omitempty"`
// LastFired is when it last fired, unix seconds; 0 never.
LastFired *int64 `json:"last_fired,omitempty"`
Neutral *int64 `json:"neutral,omitempty"`
RepairRate *float64 `json:"repair_rate,omitempty"`
// Repairs are fires that changed the label and no correction contradicts; Damage, fires whose label a correction put back to the base's; Neutral, fires that kept the base's label.
Repairs *int64 `json:"repairs,omitempty"`
Version *int64 `json:"version,omitempty"`
AdditionalProperties map[string]interface{}
}
type _TrainLive TrainLive
// NewTrainLive instantiates a new TrainLive 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 NewTrainLive() *TrainLive {
this := TrainLive{}
return &this
}
// NewTrainLiveWithDefaults instantiates a new TrainLive 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 NewTrainLiveWithDefaults() *TrainLive {
this := TrainLive{}
return &this
}
// GetDamage returns the Damage field value if set, zero value otherwise.
func (o *TrainLive) GetDamage() int64 {
if o == nil || IsNil(o.Damage) {
var ret int64
return ret
}
return *o.Damage
}
// GetDamageOk returns a tuple with the Damage field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainLive) GetDamageOk() (*int64, bool) {
if o == nil || IsNil(o.Damage) {
return nil, false
}
return o.Damage, true
}
// HasDamage returns a boolean if a field has been set.
func (o *TrainLive) HasDamage() bool {
if o != nil && !IsNil(o.Damage) {
return true
}
return false
}
// SetDamage gets a reference to the given int64 and assigns it to the Damage field.
func (o *TrainLive) SetDamage(v int64) {
o.Damage = &v
}
// GetDamageRate returns the DamageRate field value if set, zero value otherwise.
func (o *TrainLive) GetDamageRate() float64 {
if o == nil || IsNil(o.DamageRate) {
var ret float64
return ret
}
return *o.DamageRate
}
// GetDamageRateOk returns a tuple with the DamageRate field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainLive) GetDamageRateOk() (*float64, bool) {
if o == nil || IsNil(o.DamageRate) {
return nil, false
}
return o.DamageRate, true
}
// HasDamageRate returns a boolean if a field has been set.
func (o *TrainLive) HasDamageRate() bool {
if o != nil && !IsNil(o.DamageRate) {
return true
}
return false
}
// SetDamageRate gets a reference to the given float64 and assigns it to the DamageRate field.
func (o *TrainLive) SetDamageRate(v float64) {
o.DamageRate = &v
}
// GetFires returns the Fires field value if set, zero value otherwise.
func (o *TrainLive) GetFires() int64 {
if o == nil || IsNil(o.Fires) {
var ret int64
return ret
}
return *o.Fires
}
// GetFiresOk returns a tuple with the Fires field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainLive) GetFiresOk() (*int64, bool) {
if o == nil || IsNil(o.Fires) {
return nil, false
}
return o.Fires, true
}
// HasFires returns a boolean if a field has been set.
func (o *TrainLive) HasFires() bool {
if o != nil && !IsNil(o.Fires) {
return true
}
return false
}
// SetFires gets a reference to the given int64 and assigns it to the Fires field.
func (o *TrainLive) SetFires(v int64) {
o.Fires = &v
}
// GetLastFired returns the LastFired field value if set, zero value otherwise.
func (o *TrainLive) GetLastFired() int64 {
if o == nil || IsNil(o.LastFired) {
var ret int64
return ret
}
return *o.LastFired
}
// GetLastFiredOk returns a tuple with the LastFired field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainLive) GetLastFiredOk() (*int64, bool) {
if o == nil || IsNil(o.LastFired) {
return nil, false
}
return o.LastFired, true
}
// HasLastFired returns a boolean if a field has been set.
func (o *TrainLive) HasLastFired() bool {
if o != nil && !IsNil(o.LastFired) {
return true
}
return false
}
// SetLastFired gets a reference to the given int64 and assigns it to the LastFired field.
func (o *TrainLive) SetLastFired(v int64) {
o.LastFired = &v
}
// GetNeutral returns the Neutral field value if set, zero value otherwise.
func (o *TrainLive) GetNeutral() int64 {
if o == nil || IsNil(o.Neutral) {
var ret int64
return ret
}
return *o.Neutral
}
// GetNeutralOk returns a tuple with the Neutral field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainLive) GetNeutralOk() (*int64, bool) {
if o == nil || IsNil(o.Neutral) {
return nil, false
}
return o.Neutral, true
}
// HasNeutral returns a boolean if a field has been set.
func (o *TrainLive) HasNeutral() bool {
if o != nil && !IsNil(o.Neutral) {
return true
}
return false
}
// SetNeutral gets a reference to the given int64 and assigns it to the Neutral field.
func (o *TrainLive) SetNeutral(v int64) {
o.Neutral = &v
}
// GetRepairRate returns the RepairRate field value if set, zero value otherwise.
func (o *TrainLive) GetRepairRate() float64 {
if o == nil || IsNil(o.RepairRate) {
var ret float64
return ret
}
return *o.RepairRate
}
// GetRepairRateOk returns a tuple with the RepairRate field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainLive) GetRepairRateOk() (*float64, bool) {
if o == nil || IsNil(o.RepairRate) {
return nil, false
}
return o.RepairRate, true
}
// HasRepairRate returns a boolean if a field has been set.
func (o *TrainLive) HasRepairRate() bool {
if o != nil && !IsNil(o.RepairRate) {
return true
}
return false
}
// SetRepairRate gets a reference to the given float64 and assigns it to the RepairRate field.
func (o *TrainLive) SetRepairRate(v float64) {
o.RepairRate = &v
}
// GetRepairs returns the Repairs field value if set, zero value otherwise.
func (o *TrainLive) GetRepairs() int64 {
if o == nil || IsNil(o.Repairs) {
var ret int64
return ret
}
return *o.Repairs
}
// GetRepairsOk returns a tuple with the Repairs field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainLive) GetRepairsOk() (*int64, bool) {
if o == nil || IsNil(o.Repairs) {
return nil, false
}
return o.Repairs, true
}
// HasRepairs returns a boolean if a field has been set.
func (o *TrainLive) HasRepairs() bool {
if o != nil && !IsNil(o.Repairs) {
return true
}
return false
}
// SetRepairs gets a reference to the given int64 and assigns it to the Repairs field.
func (o *TrainLive) SetRepairs(v int64) {
o.Repairs = &v
}
// GetVersion returns the Version field value if set, zero value otherwise.
func (o *TrainLive) GetVersion() int64 {
if o == nil || IsNil(o.Version) {
var ret int64
return ret
}
return *o.Version
}
// GetVersionOk returns a tuple with the Version field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainLive) GetVersionOk() (*int64, bool) {
if o == nil || IsNil(o.Version) {
return nil, false
}
return o.Version, true
}
// HasVersion returns a boolean if a field has been set.
func (o *TrainLive) HasVersion() bool {
if o != nil && !IsNil(o.Version) {
return true
}
return false
}
// SetVersion gets a reference to the given int64 and assigns it to the Version field.
func (o *TrainLive) SetVersion(v int64) {
o.Version = &v
}
func (o TrainLive) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TrainLive) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Damage) {
toSerialize["damage"] = o.Damage
}
if !IsNil(o.DamageRate) {
toSerialize["damage_rate"] = o.DamageRate
}
if !IsNil(o.Fires) {
toSerialize["fires"] = o.Fires
}
if !IsNil(o.LastFired) {
toSerialize["last_fired"] = o.LastFired
}
if !IsNil(o.Neutral) {
toSerialize["neutral"] = o.Neutral
}
if !IsNil(o.RepairRate) {
toSerialize["repair_rate"] = o.RepairRate
}
if !IsNil(o.Repairs) {
toSerialize["repairs"] = o.Repairs
}
if !IsNil(o.Version) {
toSerialize["version"] = o.Version
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *TrainLive) UnmarshalJSON(data []byte) (err error) {
varTrainLive := _TrainLive{}
err = json.Unmarshal(data, &varTrainLive)
if err != nil {
return err
}
*o = TrainLive(varTrainLive)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "damage")
delete(additionalProperties, "damage_rate")
delete(additionalProperties, "fires")
delete(additionalProperties, "last_fired")
delete(additionalProperties, "neutral")
delete(additionalProperties, "repair_rate")
delete(additionalProperties, "repairs")
delete(additionalProperties, "version")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTrainLive struct {
value *TrainLive
isSet bool
}
func (v NullableTrainLive) Get() *TrainLive {
return v.value
}
func (v *NullableTrainLive) Set(val *TrainLive) {
v.value = val
v.isSet = true
}
func (v NullableTrainLive) IsSet() bool {
return v.isSet
}
func (v *NullableTrainLive) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTrainLive(val *TrainLive) *NullableTrainLive {
return &NullableTrainLive{value: val, isSet: true}
}
func (v NullableTrainLive) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTrainLive) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}