-- | 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
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
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
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
    { Features -> Bool
hev :: Bool
    -- ^ The light supports emitting HEV light
    , Features -> Bool
color :: Bool
    -- ^ The light changes physical appearance when the Hue value is changed
    , Features -> Bool
chain :: Bool
    -- ^ The light may be connected to physically separated hardware (currently only the LIFX Tile)
    , Features -> Bool
matrix :: Bool
    -- ^ The light supports a 2D matrix of LEDs (the Tile and Candle)
    , Features -> Bool
relays :: Bool
    -- ^ The device has relays for controlling physical power to something (the LIFX Switch)
    , Features -> Bool
buttons :: Bool
    -- ^ The device has physical buttons to press (the LIFX Switch)
    , Features -> Bool
infrared :: Bool
    -- ^ The light supports emitting infrared light
    , Features -> Bool
multizone :: Bool
    -- ^ The light supports a 1D linear array of LEDs (the Z and Beam)
    , Features -> Maybe (Word16, Word16)
temperatureRange :: Maybe (Word16, Word16)
    -- ^ 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 -> Bool
extendedMultizone :: Bool
    -- ^ 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.
    }
    deriving (Features -> Features -> Bool
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
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
Ord, Int -> Features -> ShowS
[Features] -> ShowS
Features -> String
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. 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
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)