{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE OverloadedStrings #-} module Tests.Organization where import Country.Identifier qualified as Country import Literate.Database import Literate.Document qualified as Doc import Literate.Organization import Literate.Prelude bureau1 = Address { addressText = [ "3, place du Monument" , "Mairie - Bureau 1" ] , addressCity = "Gentioux-Pigerolles" , addressZipCode = "23340" , addressCountry = Country.france } -- | Warning: the order of the constructors matters, -- `Enum` being used to generate identifying numbers sent to entities. data EntityId = EntityJulmInfo | EntityJulm | EntityUrssaf | EntityNixOSFoundationNGITeam | EntityNixOSFoundation | EntityNixOSFoundationFinance | EntityUpwork | EntityDanielRamirez deriving (Eq, Ord, Show, Enum, Generic, NFData) instance Doc.ToInline EntityId where toInline = fromEnum >>> Doc.toInline instance Get (Entity EntityId) EntityId where get entityId = case entityId of EntityJulmInfo -> (entity entityId) { entityName = Just "julminfo" , entityAddress = Just bureau1 , entitySIREN = Just "942798083" , entityIBAN = Just IBAN { ibanCountry = Country.france , ibanCheckDigits = 18 , ibanBasicBankAccountNumber = "20041010082037353D02912" } } EntityJulm -> (entity entityId) { entityName = Just "Julien Moutinho" , entityEmail = Just "julm@sourcephile.fr" -- , entityPhone = Just "+33 7 55 60 42 77" } EntityUrssaf -> (entity entityId) { entityName = Just "Urssaf" , entityAddress = Nothing , entitySIREN = Nothing , entityIBAN = Nothing } EntityNixOSFoundation -> (entity entityId) { entityName = Just "Stichting NixOS Foundation" , entityAddress = Just Address { addressText = [ "Korte Lijnbaanssteeg 1-4318" ] , addressZipCode = "1012 SL" , addressCity = "Amsterdam" , addressCountry = Country.netherlands } } EntityNixOSFoundationNGITeam -> (entity entityId) { entityName = Just "Nix@NGI Team" , entityEmail = Just "ngi@nixos.org" } EntityNixOSFoundationFinance -> (entity entityId) { entityEmail = Just "finance@nixos.org" } EntityUpwork -> (entity entityId) { entityName = Just "Upwork" , entityAddress = Nothing , entitySIREN = Nothing , entityIBAN = Nothing } EntityDanielRamirez -> (entity entityId) { entityName = Just "Daniel Ramirez" , entityEmail = Just "danielramirez5@protonmail.com" } instance Get (Organization EntityId) EntityId where get orgEntity = case orgEntity of EntityJulmInfo -> Organization { orgEntity , orgParts = [ "Admin" := EntityJulm & get ] } EntityJulm -> Organization{orgEntity, orgParts = []} EntityUrssaf -> Organization{orgEntity, orgParts = []} EntityNixOSFoundation -> Organization { orgEntity , orgParts = [ "Admin" := EntityNixOSFoundationFinance & get , "Department" := EntityNixOSFoundationNGITeam & get ] } EntityNixOSFoundationFinance -> Organization{orgEntity, orgParts = []} EntityNixOSFoundationNGITeam -> Organization { orgEntity = EntityNixOSFoundationNGITeam , orgParts = [ "Admin" := EntityDanielRamirez & get ] } EntityUpwork -> Organization { orgEntity , orgParts = [] } EntityDanielRamirez -> Organization { orgEntity = EntityDanielRamirez , orgParts = [] }