-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel_event.go
810 lines (684 loc) · 21.4 KB
/
model_event.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
/*
Routing
With the Routing service you can calculate routes from A to B taking into account vehicle-specific restrictions, traffic situations, toll, emissions, drivers' working hours, service times and opening intervals.
API version: 1.33
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package optiflow_routing
import (
"encoding/json"
"time"
"bytes"
"fmt"
)
// checks if the Event type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Event{}
// Event struct for Event
type Event struct {
// The latitude of the position where the event takes place in degrees (WGS84/EPSG:4326) from south to north.
Latitude float64 `json:"latitude"`
// The longitude of the position where the event takes place in degrees (WGS84/EPSG:4326) from west to east.
Longitude float64 `json:"longitude"`
// The time at which the event starts formatted according to [RFC 3339](https://tools.ietf.org/html/rfc3339). Will not be present for **trafficMode** _AVERAGE_ when neither **startTime** nor **arrivalTime** is specified.
StartsAt *time.Time `json:"startsAt,omitempty"`
// The distance from the start to this event [m].
DistanceFromStart int32 `json:"distanceFromStart"`
// The travel time from the start to this event [s].
TravelTimeFromStart int32 `json:"travelTimeFromStart"`
// Countries are represented according to their [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) or [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) if referring to a subdivision.
CountryCode string `json:"countryCode"`
// The offset to UTC [min]. Will not contain daylight-saving time for **trafficMode** _AVERAGE_ when neither **startTime** nor **arrivalTime** is specified.
UtcOffset int32 `json:"utcOffset"`
Toll *TollEvent `json:"toll,omitempty"`
Maneuver *ManeuverEvent `json:"maneuver,omitempty"`
Border *BorderEvent `json:"border,omitempty"`
Violation *ViolationEvent `json:"violation,omitempty"`
Waypoint *WaypointEvent `json:"waypoint,omitempty"`
UtcOffsetChange *UTCOffsetChangeEvent `json:"utcOffsetChange,omitempty"`
Schedule *ScheduleEvent `json:"schedule,omitempty"`
CombinedTransport *CombinedTransportEvent `json:"combinedTransport,omitempty"`
Traffic *TrafficEvent `json:"traffic,omitempty"`
LowEmissionZone *LowEmissionZoneEvent `json:"lowEmissionZone,omitempty"`
DeliveryOnly *DeliveryOnlyEvent `json:"deliveryOnly,omitempty"`
EvStatus *EvStatusEvent `json:"evStatus,omitempty"`
Charge *ChargeEvent `json:"charge,omitempty"`
}
type _Event Event
// NewEvent instantiates a new Event 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 NewEvent(latitude float64, longitude float64, distanceFromStart int32, travelTimeFromStart int32, countryCode string, utcOffset int32) *Event {
this := Event{}
this.Latitude = latitude
this.Longitude = longitude
this.DistanceFromStart = distanceFromStart
this.TravelTimeFromStart = travelTimeFromStart
this.CountryCode = countryCode
this.UtcOffset = utcOffset
return &this
}
// NewEventWithDefaults instantiates a new Event 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 NewEventWithDefaults() *Event {
this := Event{}
return &this
}
// GetLatitude returns the Latitude field value
func (o *Event) GetLatitude() float64 {
if o == nil {
var ret float64
return ret
}
return o.Latitude
}
// GetLatitudeOk returns a tuple with the Latitude field value
// and a boolean to check if the value has been set.
func (o *Event) GetLatitudeOk() (*float64, bool) {
if o == nil {
return nil, false
}
return &o.Latitude, true
}
// SetLatitude sets field value
func (o *Event) SetLatitude(v float64) {
o.Latitude = v
}
// GetLongitude returns the Longitude field value
func (o *Event) GetLongitude() float64 {
if o == nil {
var ret float64
return ret
}
return o.Longitude
}
// GetLongitudeOk returns a tuple with the Longitude field value
// and a boolean to check if the value has been set.
func (o *Event) GetLongitudeOk() (*float64, bool) {
if o == nil {
return nil, false
}
return &o.Longitude, true
}
// SetLongitude sets field value
func (o *Event) SetLongitude(v float64) {
o.Longitude = v
}
// GetStartsAt returns the StartsAt field value if set, zero value otherwise.
func (o *Event) GetStartsAt() time.Time {
if o == nil || IsNil(o.StartsAt) {
var ret time.Time
return ret
}
return *o.StartsAt
}
// GetStartsAtOk returns a tuple with the StartsAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetStartsAtOk() (*time.Time, bool) {
if o == nil || IsNil(o.StartsAt) {
return nil, false
}
return o.StartsAt, true
}
// HasStartsAt returns a boolean if a field has been set.
func (o *Event) HasStartsAt() bool {
if o != nil && !IsNil(o.StartsAt) {
return true
}
return false
}
// SetStartsAt gets a reference to the given time.Time and assigns it to the StartsAt field.
func (o *Event) SetStartsAt(v time.Time) {
o.StartsAt = &v
}
// GetDistanceFromStart returns the DistanceFromStart field value
func (o *Event) GetDistanceFromStart() int32 {
if o == nil {
var ret int32
return ret
}
return o.DistanceFromStart
}
// GetDistanceFromStartOk returns a tuple with the DistanceFromStart field value
// and a boolean to check if the value has been set.
func (o *Event) GetDistanceFromStartOk() (*int32, bool) {
if o == nil {
return nil, false
}
return &o.DistanceFromStart, true
}
// SetDistanceFromStart sets field value
func (o *Event) SetDistanceFromStart(v int32) {
o.DistanceFromStart = v
}
// GetTravelTimeFromStart returns the TravelTimeFromStart field value
func (o *Event) GetTravelTimeFromStart() int32 {
if o == nil {
var ret int32
return ret
}
return o.TravelTimeFromStart
}
// GetTravelTimeFromStartOk returns a tuple with the TravelTimeFromStart field value
// and a boolean to check if the value has been set.
func (o *Event) GetTravelTimeFromStartOk() (*int32, bool) {
if o == nil {
return nil, false
}
return &o.TravelTimeFromStart, true
}
// SetTravelTimeFromStart sets field value
func (o *Event) SetTravelTimeFromStart(v int32) {
o.TravelTimeFromStart = v
}
// GetCountryCode returns the CountryCode field value
func (o *Event) GetCountryCode() string {
if o == nil {
var ret string
return ret
}
return o.CountryCode
}
// GetCountryCodeOk returns a tuple with the CountryCode field value
// and a boolean to check if the value has been set.
func (o *Event) GetCountryCodeOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.CountryCode, true
}
// SetCountryCode sets field value
func (o *Event) SetCountryCode(v string) {
o.CountryCode = v
}
// GetUtcOffset returns the UtcOffset field value
func (o *Event) GetUtcOffset() int32 {
if o == nil {
var ret int32
return ret
}
return o.UtcOffset
}
// GetUtcOffsetOk returns a tuple with the UtcOffset field value
// and a boolean to check if the value has been set.
func (o *Event) GetUtcOffsetOk() (*int32, bool) {
if o == nil {
return nil, false
}
return &o.UtcOffset, true
}
// SetUtcOffset sets field value
func (o *Event) SetUtcOffset(v int32) {
o.UtcOffset = v
}
// GetToll returns the Toll field value if set, zero value otherwise.
func (o *Event) GetToll() TollEvent {
if o == nil || IsNil(o.Toll) {
var ret TollEvent
return ret
}
return *o.Toll
}
// GetTollOk returns a tuple with the Toll field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetTollOk() (*TollEvent, bool) {
if o == nil || IsNil(o.Toll) {
return nil, false
}
return o.Toll, true
}
// HasToll returns a boolean if a field has been set.
func (o *Event) HasToll() bool {
if o != nil && !IsNil(o.Toll) {
return true
}
return false
}
// SetToll gets a reference to the given TollEvent and assigns it to the Toll field.
func (o *Event) SetToll(v TollEvent) {
o.Toll = &v
}
// GetManeuver returns the Maneuver field value if set, zero value otherwise.
func (o *Event) GetManeuver() ManeuverEvent {
if o == nil || IsNil(o.Maneuver) {
var ret ManeuverEvent
return ret
}
return *o.Maneuver
}
// GetManeuverOk returns a tuple with the Maneuver field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetManeuverOk() (*ManeuverEvent, bool) {
if o == nil || IsNil(o.Maneuver) {
return nil, false
}
return o.Maneuver, true
}
// HasManeuver returns a boolean if a field has been set.
func (o *Event) HasManeuver() bool {
if o != nil && !IsNil(o.Maneuver) {
return true
}
return false
}
// SetManeuver gets a reference to the given ManeuverEvent and assigns it to the Maneuver field.
func (o *Event) SetManeuver(v ManeuverEvent) {
o.Maneuver = &v
}
// GetBorder returns the Border field value if set, zero value otherwise.
func (o *Event) GetBorder() BorderEvent {
if o == nil || IsNil(o.Border) {
var ret BorderEvent
return ret
}
return *o.Border
}
// GetBorderOk returns a tuple with the Border field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetBorderOk() (*BorderEvent, bool) {
if o == nil || IsNil(o.Border) {
return nil, false
}
return o.Border, true
}
// HasBorder returns a boolean if a field has been set.
func (o *Event) HasBorder() bool {
if o != nil && !IsNil(o.Border) {
return true
}
return false
}
// SetBorder gets a reference to the given BorderEvent and assigns it to the Border field.
func (o *Event) SetBorder(v BorderEvent) {
o.Border = &v
}
// GetViolation returns the Violation field value if set, zero value otherwise.
func (o *Event) GetViolation() ViolationEvent {
if o == nil || IsNil(o.Violation) {
var ret ViolationEvent
return ret
}
return *o.Violation
}
// GetViolationOk returns a tuple with the Violation field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetViolationOk() (*ViolationEvent, bool) {
if o == nil || IsNil(o.Violation) {
return nil, false
}
return o.Violation, true
}
// HasViolation returns a boolean if a field has been set.
func (o *Event) HasViolation() bool {
if o != nil && !IsNil(o.Violation) {
return true
}
return false
}
// SetViolation gets a reference to the given ViolationEvent and assigns it to the Violation field.
func (o *Event) SetViolation(v ViolationEvent) {
o.Violation = &v
}
// GetWaypoint returns the Waypoint field value if set, zero value otherwise.
func (o *Event) GetWaypoint() WaypointEvent {
if o == nil || IsNil(o.Waypoint) {
var ret WaypointEvent
return ret
}
return *o.Waypoint
}
// GetWaypointOk returns a tuple with the Waypoint field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetWaypointOk() (*WaypointEvent, bool) {
if o == nil || IsNil(o.Waypoint) {
return nil, false
}
return o.Waypoint, true
}
// HasWaypoint returns a boolean if a field has been set.
func (o *Event) HasWaypoint() bool {
if o != nil && !IsNil(o.Waypoint) {
return true
}
return false
}
// SetWaypoint gets a reference to the given WaypointEvent and assigns it to the Waypoint field.
func (o *Event) SetWaypoint(v WaypointEvent) {
o.Waypoint = &v
}
// GetUtcOffsetChange returns the UtcOffsetChange field value if set, zero value otherwise.
func (o *Event) GetUtcOffsetChange() UTCOffsetChangeEvent {
if o == nil || IsNil(o.UtcOffsetChange) {
var ret UTCOffsetChangeEvent
return ret
}
return *o.UtcOffsetChange
}
// GetUtcOffsetChangeOk returns a tuple with the UtcOffsetChange field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetUtcOffsetChangeOk() (*UTCOffsetChangeEvent, bool) {
if o == nil || IsNil(o.UtcOffsetChange) {
return nil, false
}
return o.UtcOffsetChange, true
}
// HasUtcOffsetChange returns a boolean if a field has been set.
func (o *Event) HasUtcOffsetChange() bool {
if o != nil && !IsNil(o.UtcOffsetChange) {
return true
}
return false
}
// SetUtcOffsetChange gets a reference to the given UTCOffsetChangeEvent and assigns it to the UtcOffsetChange field.
func (o *Event) SetUtcOffsetChange(v UTCOffsetChangeEvent) {
o.UtcOffsetChange = &v
}
// GetSchedule returns the Schedule field value if set, zero value otherwise.
func (o *Event) GetSchedule() ScheduleEvent {
if o == nil || IsNil(o.Schedule) {
var ret ScheduleEvent
return ret
}
return *o.Schedule
}
// GetScheduleOk returns a tuple with the Schedule field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetScheduleOk() (*ScheduleEvent, bool) {
if o == nil || IsNil(o.Schedule) {
return nil, false
}
return o.Schedule, true
}
// HasSchedule returns a boolean if a field has been set.
func (o *Event) HasSchedule() bool {
if o != nil && !IsNil(o.Schedule) {
return true
}
return false
}
// SetSchedule gets a reference to the given ScheduleEvent and assigns it to the Schedule field.
func (o *Event) SetSchedule(v ScheduleEvent) {
o.Schedule = &v
}
// GetCombinedTransport returns the CombinedTransport field value if set, zero value otherwise.
func (o *Event) GetCombinedTransport() CombinedTransportEvent {
if o == nil || IsNil(o.CombinedTransport) {
var ret CombinedTransportEvent
return ret
}
return *o.CombinedTransport
}
// GetCombinedTransportOk returns a tuple with the CombinedTransport field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetCombinedTransportOk() (*CombinedTransportEvent, bool) {
if o == nil || IsNil(o.CombinedTransport) {
return nil, false
}
return o.CombinedTransport, true
}
// HasCombinedTransport returns a boolean if a field has been set.
func (o *Event) HasCombinedTransport() bool {
if o != nil && !IsNil(o.CombinedTransport) {
return true
}
return false
}
// SetCombinedTransport gets a reference to the given CombinedTransportEvent and assigns it to the CombinedTransport field.
func (o *Event) SetCombinedTransport(v CombinedTransportEvent) {
o.CombinedTransport = &v
}
// GetTraffic returns the Traffic field value if set, zero value otherwise.
func (o *Event) GetTraffic() TrafficEvent {
if o == nil || IsNil(o.Traffic) {
var ret TrafficEvent
return ret
}
return *o.Traffic
}
// GetTrafficOk returns a tuple with the Traffic field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetTrafficOk() (*TrafficEvent, bool) {
if o == nil || IsNil(o.Traffic) {
return nil, false
}
return o.Traffic, true
}
// HasTraffic returns a boolean if a field has been set.
func (o *Event) HasTraffic() bool {
if o != nil && !IsNil(o.Traffic) {
return true
}
return false
}
// SetTraffic gets a reference to the given TrafficEvent and assigns it to the Traffic field.
func (o *Event) SetTraffic(v TrafficEvent) {
o.Traffic = &v
}
// GetLowEmissionZone returns the LowEmissionZone field value if set, zero value otherwise.
func (o *Event) GetLowEmissionZone() LowEmissionZoneEvent {
if o == nil || IsNil(o.LowEmissionZone) {
var ret LowEmissionZoneEvent
return ret
}
return *o.LowEmissionZone
}
// GetLowEmissionZoneOk returns a tuple with the LowEmissionZone field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetLowEmissionZoneOk() (*LowEmissionZoneEvent, bool) {
if o == nil || IsNil(o.LowEmissionZone) {
return nil, false
}
return o.LowEmissionZone, true
}
// HasLowEmissionZone returns a boolean if a field has been set.
func (o *Event) HasLowEmissionZone() bool {
if o != nil && !IsNil(o.LowEmissionZone) {
return true
}
return false
}
// SetLowEmissionZone gets a reference to the given LowEmissionZoneEvent and assigns it to the LowEmissionZone field.
func (o *Event) SetLowEmissionZone(v LowEmissionZoneEvent) {
o.LowEmissionZone = &v
}
// GetDeliveryOnly returns the DeliveryOnly field value if set, zero value otherwise.
func (o *Event) GetDeliveryOnly() DeliveryOnlyEvent {
if o == nil || IsNil(o.DeliveryOnly) {
var ret DeliveryOnlyEvent
return ret
}
return *o.DeliveryOnly
}
// GetDeliveryOnlyOk returns a tuple with the DeliveryOnly field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetDeliveryOnlyOk() (*DeliveryOnlyEvent, bool) {
if o == nil || IsNil(o.DeliveryOnly) {
return nil, false
}
return o.DeliveryOnly, true
}
// HasDeliveryOnly returns a boolean if a field has been set.
func (o *Event) HasDeliveryOnly() bool {
if o != nil && !IsNil(o.DeliveryOnly) {
return true
}
return false
}
// SetDeliveryOnly gets a reference to the given DeliveryOnlyEvent and assigns it to the DeliveryOnly field.
func (o *Event) SetDeliveryOnly(v DeliveryOnlyEvent) {
o.DeliveryOnly = &v
}
// GetEvStatus returns the EvStatus field value if set, zero value otherwise.
func (o *Event) GetEvStatus() EvStatusEvent {
if o == nil || IsNil(o.EvStatus) {
var ret EvStatusEvent
return ret
}
return *o.EvStatus
}
// GetEvStatusOk returns a tuple with the EvStatus field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetEvStatusOk() (*EvStatusEvent, bool) {
if o == nil || IsNil(o.EvStatus) {
return nil, false
}
return o.EvStatus, true
}
// HasEvStatus returns a boolean if a field has been set.
func (o *Event) HasEvStatus() bool {
if o != nil && !IsNil(o.EvStatus) {
return true
}
return false
}
// SetEvStatus gets a reference to the given EvStatusEvent and assigns it to the EvStatus field.
func (o *Event) SetEvStatus(v EvStatusEvent) {
o.EvStatus = &v
}
// GetCharge returns the Charge field value if set, zero value otherwise.
func (o *Event) GetCharge() ChargeEvent {
if o == nil || IsNil(o.Charge) {
var ret ChargeEvent
return ret
}
return *o.Charge
}
// GetChargeOk returns a tuple with the Charge field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Event) GetChargeOk() (*ChargeEvent, bool) {
if o == nil || IsNil(o.Charge) {
return nil, false
}
return o.Charge, true
}
// HasCharge returns a boolean if a field has been set.
func (o *Event) HasCharge() bool {
if o != nil && !IsNil(o.Charge) {
return true
}
return false
}
// SetCharge gets a reference to the given ChargeEvent and assigns it to the Charge field.
func (o *Event) SetCharge(v ChargeEvent) {
o.Charge = &v
}
func (o Event) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Event) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["latitude"] = o.Latitude
toSerialize["longitude"] = o.Longitude
if !IsNil(o.StartsAt) {
toSerialize["startsAt"] = o.StartsAt
}
toSerialize["distanceFromStart"] = o.DistanceFromStart
toSerialize["travelTimeFromStart"] = o.TravelTimeFromStart
toSerialize["countryCode"] = o.CountryCode
toSerialize["utcOffset"] = o.UtcOffset
if !IsNil(o.Toll) {
toSerialize["toll"] = o.Toll
}
if !IsNil(o.Maneuver) {
toSerialize["maneuver"] = o.Maneuver
}
if !IsNil(o.Border) {
toSerialize["border"] = o.Border
}
if !IsNil(o.Violation) {
toSerialize["violation"] = o.Violation
}
if !IsNil(o.Waypoint) {
toSerialize["waypoint"] = o.Waypoint
}
if !IsNil(o.UtcOffsetChange) {
toSerialize["utcOffsetChange"] = o.UtcOffsetChange
}
if !IsNil(o.Schedule) {
toSerialize["schedule"] = o.Schedule
}
if !IsNil(o.CombinedTransport) {
toSerialize["combinedTransport"] = o.CombinedTransport
}
if !IsNil(o.Traffic) {
toSerialize["traffic"] = o.Traffic
}
if !IsNil(o.LowEmissionZone) {
toSerialize["lowEmissionZone"] = o.LowEmissionZone
}
if !IsNil(o.DeliveryOnly) {
toSerialize["deliveryOnly"] = o.DeliveryOnly
}
if !IsNil(o.EvStatus) {
toSerialize["evStatus"] = o.EvStatus
}
if !IsNil(o.Charge) {
toSerialize["charge"] = o.Charge
}
return toSerialize, nil
}
func (o *Event) 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{
"latitude",
"longitude",
"distanceFromStart",
"travelTimeFromStart",
"countryCode",
"utcOffset",
}
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)
}
}
varEvent := _Event{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varEvent)
if err != nil {
return err
}
*o = Event(varEvent)
return err
}
type NullableEvent struct {
value *Event
isSet bool
}
func (v NullableEvent) Get() *Event {
return v.value
}
func (v *NullableEvent) Set(val *Event) {
v.value = val
v.isSet = true
}
func (v NullableEvent) IsSet() bool {
return v.isSet
}
func (v *NullableEvent) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableEvent(val *Event) *NullableEvent {
return &NullableEvent{value: val, isSet: true}
}
func (v NullableEvent) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableEvent) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}