aboutsummaryrefslogtreecommitdiff
path: root/gtfs/GTFS/Realtime/Alert/Cause.hs
blob: 9f71db795445fb173b31a0ee046f70f505b3fec6 (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
110
111
112
113
114
115
116
117
118
{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings
 #-}
{-# OPTIONS_GHC  -w #-}
module GTFS.Realtime.Alert.Cause (Cause(..)) 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 Cause = UNKNOWN_CAUSE
           | OTHER_CAUSE
           | TECHNICAL_PROBLEM
           | STRIKE
           | DEMONSTRATION
           | ACCIDENT
           | HOLIDAY
           | WEATHER
           | MAINTENANCE
           | CONSTRUCTION
           | POLICE_ACTIVITY
           | MEDICAL_EMERGENCY
             deriving (Prelude'.Read, Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)

instance P'.Mergeable Cause

instance Prelude'.Bounded Cause where
  minBound = UNKNOWN_CAUSE
  maxBound = MEDICAL_EMERGENCY

instance P'.Default Cause where
  defaultValue = UNKNOWN_CAUSE

toMaybe'Enum :: Prelude'.Int -> P'.Maybe Cause
toMaybe'Enum 1 = Prelude'.Just UNKNOWN_CAUSE
toMaybe'Enum 2 = Prelude'.Just OTHER_CAUSE
toMaybe'Enum 3 = Prelude'.Just TECHNICAL_PROBLEM
toMaybe'Enum 4 = Prelude'.Just STRIKE
toMaybe'Enum 5 = Prelude'.Just DEMONSTRATION
toMaybe'Enum 6 = Prelude'.Just ACCIDENT
toMaybe'Enum 7 = Prelude'.Just HOLIDAY
toMaybe'Enum 8 = Prelude'.Just WEATHER
toMaybe'Enum 9 = Prelude'.Just MAINTENANCE
toMaybe'Enum 10 = Prelude'.Just CONSTRUCTION
toMaybe'Enum 11 = Prelude'.Just POLICE_ACTIVITY
toMaybe'Enum 12 = Prelude'.Just MEDICAL_EMERGENCY
toMaybe'Enum _ = Prelude'.Nothing

instance Prelude'.Enum Cause where
  fromEnum UNKNOWN_CAUSE = 1
  fromEnum OTHER_CAUSE = 2
  fromEnum TECHNICAL_PROBLEM = 3
  fromEnum STRIKE = 4
  fromEnum DEMONSTRATION = 5
  fromEnum ACCIDENT = 6
  fromEnum HOLIDAY = 7
  fromEnum WEATHER = 8
  fromEnum MAINTENANCE = 9
  fromEnum CONSTRUCTION = 10
  fromEnum POLICE_ACTIVITY = 11
  fromEnum MEDICAL_EMERGENCY = 12
  toEnum = P'.fromMaybe (Prelude'.error "hprotoc generated code: toEnum failure for type GTFS.Realtime.Alert.Cause") . toMaybe'Enum
  succ UNKNOWN_CAUSE = OTHER_CAUSE
  succ OTHER_CAUSE = TECHNICAL_PROBLEM
  succ TECHNICAL_PROBLEM = STRIKE
  succ STRIKE = DEMONSTRATION
  succ DEMONSTRATION = ACCIDENT
  succ ACCIDENT = HOLIDAY
  succ HOLIDAY = WEATHER
  succ WEATHER = MAINTENANCE
  succ MAINTENANCE = CONSTRUCTION
  succ CONSTRUCTION = POLICE_ACTIVITY
  succ POLICE_ACTIVITY = MEDICAL_EMERGENCY
  succ _ = Prelude'.error "hprotoc generated code: succ failure for type GTFS.Realtime.Alert.Cause"
  pred OTHER_CAUSE = UNKNOWN_CAUSE
  pred TECHNICAL_PROBLEM = OTHER_CAUSE
  pred STRIKE = TECHNICAL_PROBLEM
  pred DEMONSTRATION = STRIKE
  pred ACCIDENT = DEMONSTRATION
  pred HOLIDAY = ACCIDENT
  pred WEATHER = HOLIDAY
  pred MAINTENANCE = WEATHER
  pred CONSTRUCTION = MAINTENANCE
  pred POLICE_ACTIVITY = CONSTRUCTION
  pred MEDICAL_EMERGENCY = POLICE_ACTIVITY
  pred _ = Prelude'.error "hprotoc generated code: pred failure for type GTFS.Realtime.Alert.Cause"

instance P'.Wire Cause 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 Cause

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

instance P'.ReflectEnum Cause where
  reflectEnum
   = [(1, "UNKNOWN_CAUSE", UNKNOWN_CAUSE), (2, "OTHER_CAUSE", OTHER_CAUSE), (3, "TECHNICAL_PROBLEM", TECHNICAL_PROBLEM),
      (4, "STRIKE", STRIKE), (5, "DEMONSTRATION", DEMONSTRATION), (6, "ACCIDENT", ACCIDENT), (7, "HOLIDAY", HOLIDAY),
      (8, "WEATHER", WEATHER), (9, "MAINTENANCE", MAINTENANCE), (10, "CONSTRUCTION", CONSTRUCTION),
      (11, "POLICE_ACTIVITY", POLICE_ACTIVITY), (12, "MEDICAL_EMERGENCY", MEDICAL_EMERGENCY)]
  reflectEnumInfo _
   = P'.EnumInfo (P'.makePNF (P'.pack ".transit_realtime.Alert.Cause") [] ["GTFS", "Realtime", "Alert"] "Cause")
      ["GTFS", "Realtime", "Alert", "Cause.hs"]
      [(1, "UNKNOWN_CAUSE"), (2, "OTHER_CAUSE"), (3, "TECHNICAL_PROBLEM"), (4, "STRIKE"), (5, "DEMONSTRATION"), (6, "ACCIDENT"),
       (7, "HOLIDAY"), (8, "WEATHER"), (9, "MAINTENANCE"), (10, "CONSTRUCTION"), (11, "POLICE_ACTIVITY"), (12, "MEDICAL_EMERGENCY")]
      Prelude'.False

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