aboutsummaryrefslogtreecommitdiff
path: root/gtfs/GTFS/Realtime/VehiclePosition/OccupancyStatus.hs
blob: 92d4064e8fec53ab666e12d95c71df90940ea929 (plain)
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
{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings
 #-}
{-# OPTIONS_GHC  -w #-}
module GTFS.Realtime.VehiclePosition.OccupancyStatus (OccupancyStatus(..)) where
import Prelude ((+), (/), (.))
import qualified Prelude as Prelude'
import qualified Data.List as Prelude'
import qualified Data.Typeable as Prelude'
import qualified GHC.Generics as Prelude'
import qualified Data.Data as Prelude'
import qualified Text.ProtocolBuffers.Header as P'

data OccupancyStatus = EMPTY
                     | MANY_SEATS_AVAILABLE
                     | FEW_SEATS_AVAILABLE
                     | STANDING_ROOM_ONLY
                     | CRUSHED_STANDING_ROOM_ONLY
                     | FULL
                     | NOT_ACCEPTING_PASSENGERS
                     | NO_DATA_AVAILABLE
                     | NOT_BOARDABLE
                       deriving (Prelude'.Read, Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data,
                                 Prelude'.Generic)

instance P'.Mergeable OccupancyStatus

instance Prelude'.Bounded OccupancyStatus where
  minBound = EMPTY
  maxBound = NOT_BOARDABLE

instance P'.Default OccupancyStatus where
  defaultValue = EMPTY

toMaybe'Enum :: Prelude'.Int -> P'.Maybe OccupancyStatus
toMaybe'Enum 0 = Prelude'.Just EMPTY
toMaybe'Enum 1 = Prelude'.Just MANY_SEATS_AVAILABLE
toMaybe'Enum 2 = Prelude'.Just FEW_SEATS_AVAILABLE
toMaybe'Enum 3 = Prelude'.Just STANDING_ROOM_ONLY
toMaybe'Enum 4 = Prelude'.Just CRUSHED_STANDING_ROOM_ONLY
toMaybe'Enum 5 = Prelude'.Just FULL
toMaybe'Enum 6 = Prelude'.Just NOT_ACCEPTING_PASSENGERS
toMaybe'Enum 7 = Prelude'.Just NO_DATA_AVAILABLE
toMaybe'Enum 8 = Prelude'.Just NOT_BOARDABLE
toMaybe'Enum _ = Prelude'.Nothing

instance Prelude'.Enum OccupancyStatus where
  fromEnum EMPTY = 0
  fromEnum MANY_SEATS_AVAILABLE = 1
  fromEnum FEW_SEATS_AVAILABLE = 2
  fromEnum STANDING_ROOM_ONLY = 3
  fromEnum CRUSHED_STANDING_ROOM_ONLY = 4
  fromEnum FULL = 5
  fromEnum NOT_ACCEPTING_PASSENGERS = 6
  fromEnum NO_DATA_AVAILABLE = 7
  fromEnum NOT_BOARDABLE = 8
  toEnum
   = P'.fromMaybe (Prelude'.error "hprotoc generated code: toEnum failure for type GTFS.Realtime.VehiclePosition.OccupancyStatus") .
      toMaybe'Enum
  succ EMPTY = MANY_SEATS_AVAILABLE
  succ MANY_SEATS_AVAILABLE = FEW_SEATS_AVAILABLE
  succ FEW_SEATS_AVAILABLE = STANDING_ROOM_ONLY
  succ STANDING_ROOM_ONLY = CRUSHED_STANDING_ROOM_ONLY
  succ CRUSHED_STANDING_ROOM_ONLY = FULL
  succ FULL = NOT_ACCEPTING_PASSENGERS
  succ NOT_ACCEPTING_PASSENGERS = NO_DATA_AVAILABLE
  succ NO_DATA_AVAILABLE = NOT_BOARDABLE
  succ _ = Prelude'.error "hprotoc generated code: succ failure for type GTFS.Realtime.VehiclePosition.OccupancyStatus"
  pred MANY_SEATS_AVAILABLE = EMPTY
  pred FEW_SEATS_AVAILABLE = MANY_SEATS_AVAILABLE
  pred STANDING_ROOM_ONLY = FEW_SEATS_AVAILABLE
  pred CRUSHED_STANDING_ROOM_ONLY = STANDING_ROOM_ONLY
  pred FULL = CRUSHED_STANDING_ROOM_ONLY
  pred NOT_ACCEPTING_PASSENGERS = FULL
  pred NO_DATA_AVAILABLE = NOT_ACCEPTING_PASSENGERS
  pred NOT_BOARDABLE = NO_DATA_AVAILABLE
  pred _ = Prelude'.error "hprotoc generated code: pred failure for type GTFS.Realtime.VehiclePosition.OccupancyStatus"

instance P'.Wire OccupancyStatus where
  wireSize ft' enum = P'.wireSize ft' (Prelude'.fromEnum enum)
  wirePut ft' enum = P'.wirePut ft' (Prelude'.fromEnum enum)
  wireGet 14 = P'.wireGetEnum toMaybe'Enum
  wireGet ft' = P'.wireGetErr ft'
  wireGetPacked 14 = P'.wireGetPackedEnum toMaybe'Enum
  wireGetPacked ft' = P'.wireGetErr ft'

instance P'.GPB OccupancyStatus

instance P'.MessageAPI msg' (msg' -> OccupancyStatus) OccupancyStatus where
  getVal m' f' = f' m'

instance P'.ReflectEnum OccupancyStatus where
  reflectEnum
   = [(0, "EMPTY", EMPTY), (1, "MANY_SEATS_AVAILABLE", MANY_SEATS_AVAILABLE), (2, "FEW_SEATS_AVAILABLE", FEW_SEATS_AVAILABLE),
      (3, "STANDING_ROOM_ONLY", STANDING_ROOM_ONLY), (4, "CRUSHED_STANDING_ROOM_ONLY", CRUSHED_STANDING_ROOM_ONLY),
      (5, "FULL", FULL), (6, "NOT_ACCEPTING_PASSENGERS", NOT_ACCEPTING_PASSENGERS), (7, "NO_DATA_AVAILABLE", NO_DATA_AVAILABLE),
      (8, "NOT_BOARDABLE", NOT_BOARDABLE)]
  reflectEnumInfo _
   = P'.EnumInfo
      (P'.makePNF (P'.pack ".transit_realtime.VehiclePosition.OccupancyStatus") [] ["GTFS", "Realtime", "VehiclePosition"]
        "OccupancyStatus")
      ["GTFS", "Realtime", "VehiclePosition", "OccupancyStatus.hs"]
      [(0, "EMPTY"), (1, "MANY_SEATS_AVAILABLE"), (2, "FEW_SEATS_AVAILABLE"), (3, "STANDING_ROOM_ONLY"),
       (4, "CRUSHED_STANDING_ROOM_ONLY"), (5, "FULL"), (6, "NOT_ACCEPTING_PASSENGERS"), (7, "NO_DATA_AVAILABLE"),
       (8, "NOT_BOARDABLE")]
      Prelude'.False

instance P'.TextType OccupancyStatus where
  tellT = P'.tellShow
  getT = P'.getRead