structs_gen.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. package traffic
  2. // Code generated by go-bare/cmd/gen, DO NOT EDIT.
  3. import (
  4. "errors"
  5. "git.sr.ht/~sircmpwn/go-bare"
  6. )
  7. type Translation struct {
  8. Language string `bare:"language"`
  9. Value string `bare:"value"`
  10. }
  11. func (t *Translation) Decode(data []byte) error {
  12. return bare.Unmarshal(data, t)
  13. }
  14. func (t *Translation) Encode() ([]byte, error) {
  15. return bare.Marshal(t)
  16. }
  17. type Trip struct {
  18. Id string `bare:"id"`
  19. Headsign string `bare:"headsign"`
  20. TranslatedHeadsigns []Translation `bare:"translatedHeadsigns"`
  21. Direction Direction `bare:"direction"`
  22. LineID string `bare:"lineID"`
  23. ScheduleID string `bare:"scheduleID"`
  24. ShapeID string `bare:"shapeID"`
  25. Departures []Departure `bare:"departures"`
  26. }
  27. func (t *Trip) Decode(data []byte) error {
  28. return bare.Unmarshal(data, t)
  29. }
  30. func (t *Trip) Encode() ([]byte, error) {
  31. return bare.Marshal(t)
  32. }
  33. type Vehicle struct {
  34. Id string `bare:"id"`
  35. Capabilities uint16 `bare:"capabilities"`
  36. }
  37. func (t *Vehicle) Decode(data []byte) error {
  38. return bare.Unmarshal(data, t)
  39. }
  40. func (t *Vehicle) Encode() ([]byte, error) {
  41. return bare.Marshal(t)
  42. }
  43. type Departure struct {
  44. StopSequence int `bare:"stopSequence"`
  45. Time uint `bare:"time"`
  46. Pickup Boarding `bare:"pickup"`
  47. Dropoff Boarding `bare:"dropoff"`
  48. StopOffset uint `bare:"stopOffset"`
  49. }
  50. func (t *Departure) Decode(data []byte) error {
  51. return bare.Unmarshal(data, t)
  52. }
  53. func (t *Departure) Encode() ([]byte, error) {
  54. return bare.Marshal(t)
  55. }
  56. type Stop struct {
  57. Id string `bare:"id"`
  58. Code string `bare:"code"`
  59. Name string `bare:"name"`
  60. TranslatedNames []Translation `bare:"translatedNames"`
  61. NodeName string `bare:"nodeName"`
  62. TranslatedNodeNames []Translation `bare:"translatedNodeNames"`
  63. ChangeOptions []ChangeOption `bare:"changeOptions"`
  64. Zone string `bare:"zone"`
  65. Position Position `bare:"position"`
  66. Order map[string]StopOrder `bare:"order"`
  67. Timezone string `bare:"timezone"`
  68. }
  69. func (t *Stop) Decode(data []byte) error {
  70. return bare.Unmarshal(data, t)
  71. }
  72. func (t *Stop) Encode() ([]byte, error) {
  73. return bare.Marshal(t)
  74. }
  75. type ChangeOption struct {
  76. LineName string `bare:"lineName"`
  77. Headsign string `bare:"headsign"`
  78. TranslatedHeadsigns []Translation `bare:"translatedHeadsigns"`
  79. }
  80. func (t *ChangeOption) Decode(data []byte) error {
  81. return bare.Unmarshal(data, t)
  82. }
  83. func (t *ChangeOption) Encode() ([]byte, error) {
  84. return bare.Marshal(t)
  85. }
  86. type Position struct {
  87. Lat float64 `bare:"lat"`
  88. Lon float64 `bare:"lon"`
  89. }
  90. func (t *Position) Decode(data []byte) error {
  91. return bare.Unmarshal(data, t)
  92. }
  93. func (t *Position) Encode() ([]byte, error) {
  94. return bare.Marshal(t)
  95. }
  96. type LineGraph struct {
  97. StopCodes []string `bare:"stopCodes"`
  98. NextNodes map[int][]int `bare:"nextNodes"`
  99. }
  100. func (t *LineGraph) Decode(data []byte) error {
  101. return bare.Unmarshal(data, t)
  102. }
  103. func (t *LineGraph) Encode() ([]byte, error) {
  104. return bare.Marshal(t)
  105. }
  106. type StopOrder struct {
  107. TripOffset uint `bare:"tripOffset"`
  108. Sequence int `bare:"sequence"`
  109. }
  110. func (t *StopOrder) Decode(data []byte) error {
  111. return bare.Unmarshal(data, t)
  112. }
  113. func (t *StopOrder) Encode() ([]byte, error) {
  114. return bare.Marshal(t)
  115. }
  116. type Colour struct {
  117. R uint8 `bare:"r"`
  118. G uint8 `bare:"g"`
  119. B uint8 `bare:"b"`
  120. A uint8 `bare:"a"`
  121. }
  122. func (t *Colour) Decode(data []byte) error {
  123. return bare.Unmarshal(data, t)
  124. }
  125. func (t *Colour) Encode() ([]byte, error) {
  126. return bare.Marshal(t)
  127. }
  128. type Line struct {
  129. Id string `bare:"id"`
  130. Name string `bare:"name"`
  131. Colour Colour `bare:"colour"`
  132. Kind LineType `bare:"kind"`
  133. AgencyID string `bare:"agencyID"`
  134. Headsigns [][]string `bare:"headsigns"`
  135. TranslatedHeadsigns [][][]Translation `bare:"translatedHeadsigns"`
  136. Graphs []LineGraph `bare:"graphs"`
  137. }
  138. func (t *Line) Decode(data []byte) error {
  139. return bare.Unmarshal(data, t)
  140. }
  141. func (t *Line) Encode() ([]byte, error) {
  142. return bare.Marshal(t)
  143. }
  144. type FeedInfo struct {
  145. Name string `bare:"name"`
  146. Website string `bare:"website"`
  147. Language string `bare:"language"`
  148. ValidSince string `bare:"validSince"`
  149. ValidTill string `bare:"validTill"`
  150. QrHost string `bare:"qrHost"`
  151. QrLocation QRLocation `bare:"qrLocation"`
  152. QrSelector string `bare:"qrSelector"`
  153. Attributions map[string]string `bare:"attributions"`
  154. Descriptions map[string]string `bare:"descriptions"`
  155. RealtimeFeeds map[RealtimeFeedType]string `bare:"realtimeFeeds"`
  156. Timezone string `bare:"timezone"`
  157. }
  158. func (t *FeedInfo) Decode(data []byte) error {
  159. return bare.Unmarshal(data, t)
  160. }
  161. func (t *FeedInfo) Encode() ([]byte, error) {
  162. return bare.Marshal(t)
  163. }
  164. type Agency struct {
  165. Id string `bare:"id"`
  166. Name string `bare:"name"`
  167. TranslatedNames []Translation `bare:"translatedNames"`
  168. Website string `bare:"website"`
  169. TranslatedWebsites []Translation `bare:"translatedWebsites"`
  170. Timezone string `bare:"timezone"`
  171. PhoneNumber string `bare:"phoneNumber"`
  172. TranslatedPhoneNumbers []Translation `bare:"translatedPhoneNumbers"`
  173. Language string `bare:"language"`
  174. Email string `bare:"email"`
  175. TranslatedEmails []Translation `bare:"translatedEmails"`
  176. FareWebsite string `bare:"fareWebsite"`
  177. TranslatedFareWebsites []Translation `bare:"translatedFareWebsites"`
  178. }
  179. func (t *Agency) Decode(data []byte) error {
  180. return bare.Unmarshal(data, t)
  181. }
  182. func (t *Agency) Encode() ([]byte, error) {
  183. return bare.Marshal(t)
  184. }
  185. type NameOffset struct {
  186. Name string `bare:"name"`
  187. Offsets []uint `bare:"offsets"`
  188. }
  189. func (t *NameOffset) Decode(data []byte) error {
  190. return bare.Unmarshal(data, t)
  191. }
  192. func (t *NameOffset) Encode() ([]byte, error) {
  193. return bare.Marshal(t)
  194. }
  195. type CodeIndex map[string]uint
  196. func (t *CodeIndex) Decode(data []byte) error {
  197. return bare.Unmarshal(data, t)
  198. }
  199. func (t *CodeIndex) Encode() ([]byte, error) {
  200. return bare.Marshal(t)
  201. }
  202. type Schedule struct {
  203. Id string `bare:"id"`
  204. DateRanges []DateRange `bare:"dateRanges"`
  205. }
  206. func (t *Schedule) Decode(data []byte) error {
  207. return bare.Unmarshal(data, t)
  208. }
  209. func (t *Schedule) Encode() ([]byte, error) {
  210. return bare.Marshal(t)
  211. }
  212. type DateRange struct {
  213. Start string `bare:"start"`
  214. End string `bare:"end"`
  215. Weekdays uint8 `bare:"weekdays"`
  216. }
  217. func (t *DateRange) Decode(data []byte) error {
  218. return bare.Unmarshal(data, t)
  219. }
  220. func (t *DateRange) Encode() ([]byte, error) {
  221. return bare.Marshal(t)
  222. }
  223. type TimeRange struct {
  224. StartDate string `bare:"startDate"`
  225. EndDate string `bare:"endDate"`
  226. }
  227. func (t *TimeRange) Decode(data []byte) error {
  228. return bare.Unmarshal(data, t)
  229. }
  230. func (t *TimeRange) Encode() ([]byte, error) {
  231. return bare.Marshal(t)
  232. }
  233. type AlertLua struct {
  234. TimeRanges []TimeRange `bare:"timeRanges"`
  235. Headers map[string]string `bare:"headers"`
  236. Descriptions map[string]string `bare:"descriptions"`
  237. Urls map[string]string `bare:"urls"`
  238. Cause int `bare:"cause"`
  239. Effect int `bare:"effect"`
  240. }
  241. func (t *AlertLua) Decode(data []byte) error {
  242. return bare.Unmarshal(data, t)
  243. }
  244. func (t *AlertLua) Encode() ([]byte, error) {
  245. return bare.Marshal(t)
  246. }
  247. type LuaUpdates struct {
  248. AreTripsInTimetable bool `bare:"areTripsInTimetable"`
  249. Updates map[string]Update `bare:"updates"`
  250. Alerts map[string][]AlertLua `bare:"alerts"`
  251. }
  252. func (t *LuaUpdates) Decode(data []byte) error {
  253. return bare.Unmarshal(data, t)
  254. }
  255. func (t *LuaUpdates) Encode() ([]byte, error) {
  256. return bare.Marshal(t)
  257. }
  258. type LuaError struct {
  259. HttpResponseCode int `bare:"httpResponseCode"`
  260. Message string `bare:"message"`
  261. WillNextRequestFail bool `bare:"willNextRequestFail"`
  262. }
  263. func (t *LuaError) Decode(data []byte) error {
  264. return bare.Unmarshal(data, t)
  265. }
  266. func (t *LuaError) Encode() ([]byte, error) {
  267. return bare.Marshal(t)
  268. }
  269. type Update struct {
  270. Time string `bare:"time"`
  271. TimeUTC string `bare:"timeUTC"`
  272. StopSequence uint32 `bare:"stopSequence"`
  273. StopID string `bare:"stopID"`
  274. Delay int32 `bare:"delay"`
  275. TimetableRelationship TimetableRelationship `bare:"timetableRelationship"`
  276. VehicleStatus VehicleStatus `bare:"vehicleStatus"`
  277. }
  278. func (t *Update) Decode(data []byte) error {
  279. return bare.Unmarshal(data, t)
  280. }
  281. func (t *Update) Encode() ([]byte, error) {
  282. return bare.Marshal(t)
  283. }
  284. type VehicleStatus struct {
  285. Status DepartureStatus `bare:"status"`
  286. CongestionLevel CongestionLevel `bare:"congestionLevel"`
  287. OccupancyStatus OccupancyStatus `bare:"occupancyStatus"`
  288. VehicleID string `bare:"vehicleID"`
  289. Latitude float64 `bare:"latitude"`
  290. Longitude float64 `bare:"longitude"`
  291. Speed float32 `bare:"speed"`
  292. Bearing float64 `bare:"bearing"`
  293. LineID string `bare:"lineID"`
  294. LineName string `bare:"lineName"`
  295. Headsign string `bare:"headsign"`
  296. TripID string `bare:"tripID"`
  297. WheelchairAccessibility WheelchairAccessibility `bare:"wheelchairAccessibility"`
  298. }
  299. func (t *VehicleStatus) Decode(data []byte) error {
  300. return bare.Unmarshal(data, t)
  301. }
  302. func (t *VehicleStatus) Encode() ([]byte, error) {
  303. return bare.Marshal(t)
  304. }
  305. type Direction uint
  306. const (
  307. THERE Direction = 0
  308. BACK Direction = 1
  309. )
  310. func (t Direction) String() string {
  311. switch t {
  312. case THERE:
  313. return "THERE"
  314. case BACK:
  315. return "BACK"
  316. }
  317. panic(errors.New("Invalid Direction value"))
  318. }
  319. type VehicleCapabilities uint
  320. const (
  321. RAMP VehicleCapabilities = 1
  322. LOW_FLOOR VehicleCapabilities = 2
  323. AIR_CONDITIONING VehicleCapabilities = 4
  324. BICYCLE VehicleCapabilities = 8
  325. VOICE_ANNOUNCEMENTS VehicleCapabilities = 16
  326. TICKET_MACHINE VehicleCapabilities = 32
  327. TICKET_SOLD_DRIVER VehicleCapabilities = 64
  328. USB_CHARGING VehicleCapabilities = 128
  329. LOW_FLOOR_PARTIAL VehicleCapabilities = 256
  330. )
  331. func (t VehicleCapabilities) String() string {
  332. switch t {
  333. case RAMP:
  334. return "RAMP"
  335. case LOW_FLOOR:
  336. return "LOW_FLOOR"
  337. case AIR_CONDITIONING:
  338. return "AIR_CONDITIONING"
  339. case BICYCLE:
  340. return "BICYCLE"
  341. case VOICE_ANNOUNCEMENTS:
  342. return "VOICE_ANNOUNCEMENTS"
  343. case TICKET_MACHINE:
  344. return "TICKET_MACHINE"
  345. case TICKET_SOLD_DRIVER:
  346. return "TICKET_SOLD_DRIVER"
  347. case USB_CHARGING:
  348. return "USB_CHARGING"
  349. case LOW_FLOOR_PARTIAL:
  350. return "LOW_FLOOR_PARTIAL"
  351. }
  352. panic(errors.New("Invalid VehicleCapabilities value"))
  353. }
  354. type Boarding uint
  355. const (
  356. REGULAR Boarding = 0
  357. NONE Boarding = 1
  358. BY_PHONE Boarding = 2
  359. BY_DRIVER Boarding = 3
  360. )
  361. func (t Boarding) String() string {
  362. switch t {
  363. case REGULAR:
  364. return "REGULAR"
  365. case NONE:
  366. return "NONE"
  367. case BY_PHONE:
  368. return "BY_PHONE"
  369. case BY_DRIVER:
  370. return "BY_DRIVER"
  371. }
  372. panic(errors.New("Invalid Boarding value"))
  373. }
  374. type LineType uint
  375. const (
  376. TRAM LineType = 0
  377. METRO LineType = 1
  378. RAIL LineType = 2
  379. BUS LineType = 3
  380. FERRY LineType = 4
  381. CABLE_TRAM LineType = 5
  382. CABLE_CAR LineType = 6
  383. FUNICULAR LineType = 7
  384. TROLLEYBUS LineType = 11
  385. MONORAIL LineType = 12
  386. )
  387. func (t LineType) String() string {
  388. switch t {
  389. case TRAM:
  390. return "TRAM"
  391. case METRO:
  392. return "METRO"
  393. case RAIL:
  394. return "RAIL"
  395. case BUS:
  396. return "BUS"
  397. case FERRY:
  398. return "FERRY"
  399. case CABLE_TRAM:
  400. return "CABLE_TRAM"
  401. case CABLE_CAR:
  402. return "CABLE_CAR"
  403. case FUNICULAR:
  404. return "FUNICULAR"
  405. case TROLLEYBUS:
  406. return "TROLLEYBUS"
  407. case MONORAIL:
  408. return "MONORAIL"
  409. }
  410. panic(errors.New("Invalid LineType value"))
  411. }
  412. type RealtimeFeedType uint
  413. const (
  414. TRIP_UPDATES RealtimeFeedType = 0
  415. VEHICLE_POSITIONS RealtimeFeedType = 1
  416. ALERTS RealtimeFeedType = 2
  417. )
  418. func (t RealtimeFeedType) String() string {
  419. switch t {
  420. case TRIP_UPDATES:
  421. return "TRIP_UPDATES"
  422. case VEHICLE_POSITIONS:
  423. return "VEHICLE_POSITIONS"
  424. case ALERTS:
  425. return "ALERTS"
  426. }
  427. panic(errors.New("Invalid RealtimeFeedType value"))
  428. }
  429. type QRLocation uint
  430. const (
  431. QRLocationUnknown QRLocation = 0
  432. QRLocationNone QRLocation = 1
  433. QRLocationPath QRLocation = 2
  434. QRLocationQuery QRLocation = 3
  435. )
  436. func (t QRLocation) String() string {
  437. switch t {
  438. case QRLocationUnknown:
  439. return "QRLocationUnknown"
  440. case QRLocationNone:
  441. return "QRLocationNone"
  442. case QRLocationPath:
  443. return "QRLocationPath"
  444. case QRLocationQuery:
  445. return "QRLocationQuery"
  446. }
  447. panic(errors.New("Invalid QRLocation value"))
  448. }
  449. type TimetableRelationship uint
  450. const (
  451. NOT_REALTIME TimetableRelationship = 0
  452. TRIP_SCHEDULED TimetableRelationship = 1
  453. TRIP_CANCELED TimetableRelationship = 2
  454. TRIP_DELETED TimetableRelationship = 3
  455. TRIP_ADDED TimetableRelationship = 4
  456. STOP_SKIPPED TimetableRelationship = 5
  457. NO_TRIP_DATA TimetableRelationship = 6
  458. )
  459. func (t TimetableRelationship) String() string {
  460. switch t {
  461. case NOT_REALTIME:
  462. return "NOT_REALTIME"
  463. case TRIP_SCHEDULED:
  464. return "TRIP_SCHEDULED"
  465. case TRIP_CANCELED:
  466. return "TRIP_CANCELED"
  467. case TRIP_DELETED:
  468. return "TRIP_DELETED"
  469. case TRIP_ADDED:
  470. return "TRIP_ADDED"
  471. case STOP_SKIPPED:
  472. return "STOP_SKIPPED"
  473. case NO_TRIP_DATA:
  474. return "NO_TRIP_DATA"
  475. }
  476. panic(errors.New("Invalid TimetableRelationship value"))
  477. }
  478. type CongestionLevel uint
  479. const (
  480. CONGESTION_UNKNOWN CongestionLevel = 0
  481. CONGESTION_SMOOTH CongestionLevel = 1
  482. CONGESTION_STOP_AND_GO CongestionLevel = 2
  483. CONGESTION_SIGNIFICANT CongestionLevel = 3
  484. CONGESTION_SEVERE CongestionLevel = 4
  485. )
  486. func (t CongestionLevel) String() string {
  487. switch t {
  488. case CONGESTION_UNKNOWN:
  489. return "CONGESTION_UNKNOWN"
  490. case CONGESTION_SMOOTH:
  491. return "CONGESTION_SMOOTH"
  492. case CONGESTION_STOP_AND_GO:
  493. return "CONGESTION_STOP_AND_GO"
  494. case CONGESTION_SIGNIFICANT:
  495. return "CONGESTION_SIGNIFICANT"
  496. case CONGESTION_SEVERE:
  497. return "CONGESTION_SEVERE"
  498. }
  499. panic(errors.New("Invalid CongestionLevel value"))
  500. }
  501. type OccupancyStatus uint
  502. const (
  503. OCCUPANCY_UNKNOWN OccupancyStatus = 0
  504. OCCUPANCY_EMPTY OccupancyStatus = 1
  505. OCCUPANCY_MANY_AVAILABLE OccupancyStatus = 2
  506. OCCUPANCY_FEW_AVAILABLE OccupancyStatus = 3
  507. OCCUPANCY_STANDING_ONLY OccupancyStatus = 4
  508. OCCUPANCY_CRUSHED OccupancyStatus = 5
  509. OCCUPANCY_FULL OccupancyStatus = 6
  510. OCCUPANCY_NOT_ACCEPTING OccupancyStatus = 7
  511. )
  512. func (t OccupancyStatus) String() string {
  513. switch t {
  514. case OCCUPANCY_UNKNOWN:
  515. return "OCCUPANCY_UNKNOWN"
  516. case OCCUPANCY_EMPTY:
  517. return "OCCUPANCY_EMPTY"
  518. case OCCUPANCY_MANY_AVAILABLE:
  519. return "OCCUPANCY_MANY_AVAILABLE"
  520. case OCCUPANCY_FEW_AVAILABLE:
  521. return "OCCUPANCY_FEW_AVAILABLE"
  522. case OCCUPANCY_STANDING_ONLY:
  523. return "OCCUPANCY_STANDING_ONLY"
  524. case OCCUPANCY_CRUSHED:
  525. return "OCCUPANCY_CRUSHED"
  526. case OCCUPANCY_FULL:
  527. return "OCCUPANCY_FULL"
  528. case OCCUPANCY_NOT_ACCEPTING:
  529. return "OCCUPANCY_NOT_ACCEPTING"
  530. }
  531. panic(errors.New("Invalid OccupancyStatus value"))
  532. }
  533. type WheelchairAccessibility uint
  534. const (
  535. WHEELCHAIR_NO_DATA WheelchairAccessibility = 0
  536. WHEELCHAIR_UNKNOWN WheelchairAccessibility = 1
  537. WHHELCHAIR_ACCESSIBLE WheelchairAccessibility = 2
  538. WHEELCHAIR_INACCESSIBLE WheelchairAccessibility = 3
  539. )
  540. func (t WheelchairAccessibility) String() string {
  541. switch t {
  542. case WHEELCHAIR_NO_DATA:
  543. return "WHEELCHAIR_NO_DATA"
  544. case WHEELCHAIR_UNKNOWN:
  545. return "WHEELCHAIR_UNKNOWN"
  546. case WHHELCHAIR_ACCESSIBLE:
  547. return "WHHELCHAIR_ACCESSIBLE"
  548. case WHEELCHAIR_INACCESSIBLE:
  549. return "WHEELCHAIR_INACCESSIBLE"
  550. }
  551. panic(errors.New("Invalid WheelchairAccessibility value"))
  552. }
  553. type DepartureStatus uint
  554. const (
  555. IN_TRANSIT DepartureStatus = 0
  556. AT_STOP DepartureStatus = 1
  557. INCOMING DepartureStatus = 2
  558. )
  559. func (t DepartureStatus) String() string {
  560. switch t {
  561. case IN_TRANSIT:
  562. return "IN_TRANSIT"
  563. case AT_STOP:
  564. return "AT_STOP"
  565. case INCOMING:
  566. return "INCOMING"
  567. }
  568. panic(errors.New("Invalid DepartureStatus value"))
  569. }