-- | An exact mapping of the types in LIFX's `products.json`. It's easier to just use 'Lifx.Lan.getProductInfo'.
module Lifx.Internal.Product where

import Data.Text (Text)
import Data.Word (Word16, Word32)
import GHC.Generics (Generic)

data VendorInfo = VendorInfo
    { VendorInfo -> Word32
vid :: Word32
    , VendorInfo -> Text
name :: Text
    , VendorInfo -> Features
defaults :: Features
    , VendorInfo -> [ProductInfo]
products :: [ProductInfo]
    }
    deriving (Int -> VendorInfo -> ShowS
[VendorInfo] -> ShowS
VendorInfo -> String
(Int -> VendorInfo -> ShowS)
-> (VendorInfo -> String)
-> ([VendorInfo] -> ShowS)
-> Show VendorInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VendorInfo] -> ShowS
$cshowList :: [VendorInfo] -> ShowS
show :: VendorInfo -> String
$cshow :: VendorInfo -> String
showsPrec :: Int -> VendorInfo -> ShowS
$cshowsPrec :: Int -> VendorInfo -> ShowS
Show)

data ProductInfo = ProductInfo
    { ProductInfo -> Word32
pid :: Word32
    , ProductInfo -> Text
name :: Text
    , ProductInfo -> PartialFeatures
features :: PartialFeatures
    , ProductInfo -> [Upgrade]
upgrades :: [Upgrade]
    }
    deriving (Int -> ProductInfo -> ShowS
[ProductInfo] -> ShowS
ProductInfo -> String
(Int -> ProductInfo -> ShowS)
-> (ProductInfo -> String)
-> ([ProductInfo] -> ShowS)
-> Show ProductInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProductInfo] -> ShowS
$cshowList :: [ProductInfo] -> ShowS
show :: ProductInfo -> String
$cshow :: ProductInfo -> String
showsPrec :: Int -> ProductInfo -> ShowS
$cshowsPrec :: Int -> ProductInfo -> ShowS
Show)

data PartialFeatures = PartialFeatures
    { PartialFeatures -> Maybe Bool
hev :: Maybe Bool
    , PartialFeatures -> Maybe Bool
color :: Maybe Bool
    , PartialFeatures -> Maybe Bool
chain :: Maybe Bool
    , PartialFeatures -> Maybe Bool
matrix :: Maybe Bool
    , PartialFeatures -> Maybe Bool
relays :: Maybe Bool
    , PartialFeatures -> Maybe Bool
buttons :: Maybe Bool
    , PartialFeatures -> Maybe Bool
infrared :: Maybe Bool
    , PartialFeatures -> Maybe Bool
multizone :: Maybe Bool
    , PartialFeatures -> Maybe (Word16, Word16)
temperatureRange :: Maybe (Word16, Word16)
    , PartialFeatures -> Maybe Bool
extendedMultizone :: Maybe Bool
    }
    deriving (Int -> PartialFeatures -> ShowS
[PartialFeatures] -> ShowS
PartialFeatures -> String
(Int -> PartialFeatures -> ShowS)
-> (PartialFeatures -> String)
-> ([PartialFeatures] -> ShowS)
-> Show PartialFeatures
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PartialFeatures] -> ShowS
$cshowList :: [PartialFeatures] -> ShowS
show :: PartialFeatures -> String
$cshow :: PartialFeatures -> String
showsPrec :: Int -> PartialFeatures -> ShowS
$cshowsPrec :: Int -> PartialFeatures -> ShowS
Show)

data Features = Features
    { -- | The light supports emitting HEV light
      Features -> Bool
hev :: Bool
    , -- | The light changes physical appearance when the Hue value is changed
      Features -> Bool
color :: Bool
    , -- | The light may be connected to physically separated hardware (currently only the LIFX Tile)
      Features -> Bool
chain :: Bool
    , -- | The light supports a 2D matrix of LEDs (the Tile and Candle)
      Features -> Bool
matrix :: Bool
    , -- | The device has relays for controlling physical power to something (the LIFX Switch)
      Features -> Bool
relays :: Bool
    , -- | The device has physical buttons to press (the LIFX Switch)
      Features -> Bool
buttons :: Bool
    , -- | The light supports emitting infrared light
      Features -> Bool
infrared :: Bool
    , -- | The light supports a 1D linear array of LEDs (the Z and Beam)
      Features -> Bool
multizone :: Bool
    , -- | An array of the minimum and maximum kelvin values this device supports. If the numbers are the same then the device does not support variable kelvin values. It is null for devices that aren't lighting products (the LIFX Switch)
      Features -> Maybe (Word16, Word16)
temperatureRange :: Maybe (Word16, Word16)
    , -- | The more capable extended API for multizone control that lets us control all the zones on the device with a single message instead of many.
      Features -> Bool
extendedMultizone :: Bool
    }
    deriving (Features -> Features -> Bool
(Features -> Features -> Bool)
-> (Features -> Features -> Bool) -> Eq Features
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Features -> Features -> Bool
$c/= :: Features -> Features -> Bool
== :: Features -> Features -> Bool
$c== :: Features -> Features -> Bool
Eq, Eq Features
Eq Features
-> (Features -> Features -> Ordering)
-> (Features -> Features -> Bool)
-> (Features -> Features -> Bool)
-> (Features -> Features -> Bool)
-> (Features -> Features -> Bool)
-> (Features -> Features -> Features)
-> (Features -> Features -> Features)
-> Ord Features
Features -> Features -> Bool
Features -> Features -> Ordering
Features -> Features -> Features
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Features -> Features -> Features
$cmin :: Features -> Features -> Features
max :: Features -> Features -> Features
$cmax :: Features -> Features -> Features
>= :: Features -> Features -> Bool
$c>= :: Features -> Features -> Bool
> :: Features -> Features -> Bool
$c> :: Features -> Features -> Bool
<= :: Features -> Features -> Bool
$c<= :: Features -> Features -> Bool
< :: Features -> Features -> Bool
$c< :: Features -> Features -> Bool
compare :: Features -> Features -> Ordering
$ccompare :: Features -> Features -> Ordering
$cp1Ord :: Eq Features
Ord, Int -> Features -> ShowS
[Features] -> ShowS
Features -> String
(Int -> Features -> ShowS)
-> (Features -> String) -> ([Features] -> ShowS) -> Show Features
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Features] -> ShowS
$cshowList :: [Features] -> ShowS
show :: Features -> String
$cshow :: Features -> String
showsPrec :: Int -> Features -> ShowS
$cshowsPrec :: Int -> Features -> ShowS
Show, (forall x. Features -> Rep Features x)
-> (forall x. Rep Features x -> Features) -> Generic Features
forall x. Rep Features x -> Features
forall x. Features -> Rep Features x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Features x -> Features
$cfrom :: forall x. Features -> Rep Features x
Generic)

data Upgrade = Upgrade
    { Upgrade -> Word16
major :: Word16
    , Upgrade -> Word16
minor :: Word16
    , Upgrade -> PartialFeatures
features :: PartialFeatures
    }
    deriving (Int -> Upgrade -> ShowS
[Upgrade] -> ShowS
Upgrade -> String
(Int -> Upgrade -> ShowS)
-> (Upgrade -> String) -> ([Upgrade] -> ShowS) -> Show Upgrade
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Upgrade] -> ShowS
$cshowList :: [Upgrade] -> ShowS
show :: Upgrade -> String
$cshow :: Upgrade -> String
showsPrec :: Int -> Upgrade -> ShowS
$cshowsPrec :: Int -> Upgrade -> ShowS
Show)