-- | Input data types and values.
module ConditionalRestriction.Parse.InputData
  ( ID,
    Type (..),
    Value (..),
  )
where

import Data.Hourglass (DateTime)

-- | An identifier, identifying a value, e.g. @"weight"@.
type ID = String

-- | Input data type.
data Type
  = -- | Boolean type, e.g. value @"true"@.
    TBool
  | -- | Number type, e.g. value @"3.0"@.
    TNum
  | -- | Time type, e.g. value @"2022-05-10 18:00"@.
    TTime
  deriving (Type -> Type -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Type -> Type -> Bool
$c/= :: Type -> Type -> Bool
== :: Type -> Type -> Bool
$c== :: Type -> Type -> Bool
Eq, Int -> Type -> ShowS
[Type] -> ShowS
Type -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Type] -> ShowS
$cshowList :: [Type] -> ShowS
show :: Type -> String
$cshow :: Type -> String
showsPrec :: Int -> Type -> ShowS
$cshowsPrec :: Int -> Type -> ShowS
Show)

-- | Input data value, corresponding to input 'Type's.
data Value
  = -- | Boolean value, e.g. @"true"@.
    VBool Bool
  | -- | Number value, e.g. @"3.0"@.
    VNum Double
  | -- | Time value, e.g. @"2022-05-10 18:00"@.
    VTime DateTime
  deriving (Value -> Value -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Value -> Value -> Bool
$c/= :: Value -> Value -> Bool
== :: Value -> Value -> Bool
$c== :: Value -> Value -> Bool
Eq, Int -> Value -> ShowS
[Value] -> ShowS
Value -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Value] -> ShowS
$cshowList :: [Value] -> ShowS
show :: Value -> String
$cshow :: Value -> String
showsPrec :: Int -> Value -> ShowS
$cshowsPrec :: Int -> Value -> ShowS
Show)