{-|
Module      : Datatypes
Description : Módulo contendo os diferentes módulos próprios do sistema SIGES.
-}
{-# LANGUAGE DeriveGeneric #-}
module Datatypes where

import Data.ByteString
import Data.Text
import GHC.Generics
import Data.Time


-- | Versão resumida de usuário do sistema. Mantém dados essenciais, mas omite dados sensíveis que não serão necessários.
data User = User {
    User -> String
nameUser :: String  -- ^ O nome do Usuário.
   ,User -> String
emailUser :: String -- ^ O e-mail do usuário.
   ,User -> Bool
isAdminUser :: Bool -- ^ Indicação se o usuário é ou não um administrador.
} deriving(User -> User -> Bool
(User -> User -> Bool) -> (User -> User -> Bool) -> Eq User
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: User -> User -> Bool
$c/= :: User -> User -> Bool
== :: User -> User -> Bool
$c== :: User -> User -> Bool
Eq, (forall x. User -> Rep User x)
-> (forall x. Rep User x -> User) -> Generic User
forall x. Rep User x -> User
forall x. User -> Rep User x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep User x -> User
$cfrom :: forall x. User -> Rep User x
Generic)

-- | Versão completa do usuário do sistema, a ser usada quando se precisa de todas as informações do usuário.
data UserFull = UserFull {
    UserFull -> String
name :: String             -- ^ O nome do usuário.
   ,UserFull -> String
email :: String            -- ^ O e-mail do usuário.
   ,UserFull -> Text
password :: Text           -- ^ A senha (criptografada) do usuário.
   ,UserFull -> String
registrationDate :: String -- ^ A data em que o usuário se registrou.
   ,UserFull -> Bool
isAdmin :: Bool            -- ^ Indicação se o usuário é administrador.
} deriving(UserFull -> UserFull -> Bool
(UserFull -> UserFull -> Bool)
-> (UserFull -> UserFull -> Bool) -> Eq UserFull
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserFull -> UserFull -> Bool
$c/= :: UserFull -> UserFull -> Bool
== :: UserFull -> UserFull -> Bool
$c== :: UserFull -> UserFull -> Bool
Eq, Int -> UserFull -> ShowS
[UserFull] -> ShowS
UserFull -> String
(Int -> UserFull -> ShowS)
-> (UserFull -> String) -> ([UserFull] -> ShowS) -> Show UserFull
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserFull] -> ShowS
$cshowList :: [UserFull] -> ShowS
show :: UserFull -> String
$cshow :: UserFull -> String
showsPrec :: Int -> UserFull -> ShowS
$cshowsPrec :: Int -> UserFull -> ShowS
Show, (forall x. UserFull -> Rep UserFull x)
-> (forall x. Rep UserFull x -> UserFull) -> Generic UserFull
forall x. Rep UserFull x -> UserFull
forall x. UserFull -> Rep UserFull x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserFull x -> UserFull
$cfrom :: forall x. UserFull -> Rep UserFull x
Generic)


-- | Define o tipo ErrorLog como uma String.
type ErrorLog = String

-- | As diferentes telas do sistema.
data Screen = ExitScreen              -- ^ A tela de saída do sistema.
            | FirstScreen             -- ^ A tela inicial, quando nenhum administrador foi cadastrado ainda.
            | StartScreen             -- ^ A tela inicial do sistema quando já existem usuários cadastrados.
            | LoginScreen             -- ^ A tela de Login.
            | LoggedScreen            -- ^ A tela após um usuário logar-se no sistema.
            | AdminScreen             -- ^ A tela exibida após um administrador fazer login no sistema.
            | InsertRoomScreen        -- ^ A tela de cadastrar uma nova sala no sistema
            | SignUpScreen            -- ^ A tela de cadastro do usuário.
            | RemoveUserScreen        -- ^ A tela de remoção de um usuário.
            | ViewUserScreen          -- ^ A tela de visualização de salas específica de um usuário.
            | ViewScreen              -- ^ A tela com opções de visualização de salas.
            | ViewRoomScreen          -- ^ A tela de visualização de uma sala específica.
            | ViewFilterScreen        -- ^ A tela de busca de salas por filtros.
            | ReportRoomScreen        -- ^ A tela de exibição de relatório de ocupação para uma sala específica.
            | ReportDayScreen         -- ^ A tela de exibição de relatório de ocupação para todas as salas em um determinado dia.
            | CreateReservationScreen -- ^ A tela para se fazer uma nova reserva em uma sala.
            | EditReservationScreen   -- ^ A tela para se editar uma reserva previamente feita.
            | RemoveReservationScreen -- ^ A tela para se remover uma reserva previamente feita.
            deriving (Screen -> Screen -> Bool
(Screen -> Screen -> Bool)
-> (Screen -> Screen -> Bool) -> Eq Screen
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Screen -> Screen -> Bool
$c/= :: Screen -> Screen -> Bool
== :: Screen -> Screen -> Bool
$c== :: Screen -> Screen -> Bool
Eq)

-- | Uma sala do sistema SIGES.
data Room = Room {
    Room -> String
code :: String            -- ^ O código da sala.
   ,Room -> [Reservation]
schedule :: [Reservation] -- ^ A agenda onde são armazenadas todas as reservas ativas para esta sala.
   ,Room -> [Resource]
resources :: [Resource]   -- ^ A lista de recursos oferecidos pela sala.
   ,Room -> Int
capacity :: Int           -- ^ A quantidade de pessoas suportada pela sala.
   ,Room -> String
localization :: String    -- ^ A Localização da Sala.
   ,Room -> RoomCategory
category :: RoomCategory  -- ^ A categoria da sala.

} deriving (Room -> Room -> Bool
(Room -> Room -> Bool) -> (Room -> Room -> Bool) -> Eq Room
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Room -> Room -> Bool
$c/= :: Room -> Room -> Bool
== :: Room -> Room -> Bool
$c== :: Room -> Room -> Bool
Eq, (forall x. Room -> Rep Room x)
-> (forall x. Rep Room x -> Room) -> Generic Room
forall x. Rep Room x -> Room
forall x. Room -> Rep Room x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Room x -> Room
$cfrom :: forall x. Room -> Rep Room x
Generic)

-- | As reservas de salas do sistema.
data Reservation = Reservation {
    Reservation -> String
requester :: String     -- ^ O responsável pela reserva.
   ,Reservation -> String
description :: String   -- ^ A descrição do evento da reserva.
   ,Reservation -> LocalTime
startTime :: LocalTime  -- ^ O tempo de início do evento.
   ,Reservation -> LocalTime
finishTime :: LocalTime -- ^ O tempo de finalização do evento.

} deriving (Reservation -> Reservation -> Bool
(Reservation -> Reservation -> Bool)
-> (Reservation -> Reservation -> Bool) -> Eq Reservation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Reservation -> Reservation -> Bool
$c/= :: Reservation -> Reservation -> Bool
== :: Reservation -> Reservation -> Bool
$c== :: Reservation -> Reservation -> Bool
Eq, (forall x. Reservation -> Rep Reservation x)
-> (forall x. Rep Reservation x -> Reservation)
-> Generic Reservation
forall x. Rep Reservation x -> Reservation
forall x. Reservation -> Rep Reservation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Reservation x -> Reservation
$cfrom :: forall x. Reservation -> Rep Reservation x
Generic)

-- | As categorias de sala oferecidas pelo sistema.
data RoomCategory = Laboratory -- ^ Sala que funciona como um laboratório.
                  | Auditorium -- ^ Sala que funciona como um auditório.
                  | Classroom  -- ^ Sala que funciona como uma sala de aula.
                  | Office     -- ^ Sala que funciona como um escritório.
                  | Warehouse  -- ^ Sala que funciona como um depósito.
                  deriving (RoomCategory -> RoomCategory -> Bool
(RoomCategory -> RoomCategory -> Bool)
-> (RoomCategory -> RoomCategory -> Bool) -> Eq RoomCategory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RoomCategory -> RoomCategory -> Bool
$c/= :: RoomCategory -> RoomCategory -> Bool
== :: RoomCategory -> RoomCategory -> Bool
$c== :: RoomCategory -> RoomCategory -> Bool
Eq, Int -> RoomCategory -> ShowS
[RoomCategory] -> ShowS
RoomCategory -> String
(Int -> RoomCategory -> ShowS)
-> (RoomCategory -> String)
-> ([RoomCategory] -> ShowS)
-> Show RoomCategory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RoomCategory] -> ShowS
$cshowList :: [RoomCategory] -> ShowS
show :: RoomCategory -> String
$cshow :: RoomCategory -> String
showsPrec :: Int -> RoomCategory -> ShowS
$cshowsPrec :: Int -> RoomCategory -> ShowS
Show, (forall x. RoomCategory -> Rep RoomCategory x)
-> (forall x. Rep RoomCategory x -> RoomCategory)
-> Generic RoomCategory
forall x. Rep RoomCategory x -> RoomCategory
forall x. RoomCategory -> Rep RoomCategory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RoomCategory x -> RoomCategory
$cfrom :: forall x. RoomCategory -> Rep RoomCategory x
Generic)

-- | Os tipos de recursos existentes no sistema.
data ResourceKind = Projector      -- ^ Projetor ou Datashow.
                  | Microscope     -- ^ Microscópio.
                  | Desk           -- ^ Escrivaninha.
                  | Computer       -- ^ Computador.
                  | Board          -- ^ Quadro negro ou branco.
                  | AirConditioner -- ^ Ar condicionado.
              deriving (ResourceKind -> ResourceKind -> Bool
(ResourceKind -> ResourceKind -> Bool)
-> (ResourceKind -> ResourceKind -> Bool) -> Eq ResourceKind
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceKind -> ResourceKind -> Bool
$c/= :: ResourceKind -> ResourceKind -> Bool
== :: ResourceKind -> ResourceKind -> Bool
$c== :: ResourceKind -> ResourceKind -> Bool
Eq, Int -> ResourceKind -> ShowS
[ResourceKind] -> ShowS
ResourceKind -> String
(Int -> ResourceKind -> ShowS)
-> (ResourceKind -> String)
-> ([ResourceKind] -> ShowS)
-> Show ResourceKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceKind] -> ShowS
$cshowList :: [ResourceKind] -> ShowS
show :: ResourceKind -> String
$cshow :: ResourceKind -> String
showsPrec :: Int -> ResourceKind -> ShowS
$cshowsPrec :: Int -> ResourceKind -> ShowS
Show, (forall x. ResourceKind -> Rep ResourceKind x)
-> (forall x. Rep ResourceKind x -> ResourceKind)
-> Generic ResourceKind
forall x. Rep ResourceKind x -> ResourceKind
forall x. ResourceKind -> Rep ResourceKind x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceKind x -> ResourceKind
$cfrom :: forall x. ResourceKind -> Rep ResourceKind x
Generic)

-- | Os recursos oferecidos pelas salas do sistema.
data Resource = Resource {
    Resource -> ResourceKind
resourceKind :: ResourceKind -- ^ O tipo do recurso.
   ,Resource -> Int
resourceQuantity :: Int      -- ^ A quantidade do recurso que a sala oferece.
}deriving (Resource -> Resource -> Bool
(Resource -> Resource -> Bool)
-> (Resource -> Resource -> Bool) -> Eq Resource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Resource -> Resource -> Bool
$c/= :: Resource -> Resource -> Bool
== :: Resource -> Resource -> Bool
$c== :: Resource -> Resource -> Bool
Eq, (forall x. Resource -> Rep Resource x)
-> (forall x. Rep Resource x -> Resource) -> Generic Resource
forall x. Rep Resource x -> Resource
forall x. Resource -> Rep Resource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Resource x -> Resource
$cfrom :: forall x. Resource -> Rep Resource x
Generic)