module Drasil.NoPCM.Requirements (funcReqs, inputInitValsTable) where

import Language.Drasil
import Drasil.DocLang (mkInputPropsTable)
import Language.Drasil.Chunk.Concept.NamedCombinators

import Data.Drasil.Concepts.Documentation (funcReqDom, input_, value)

import Data.Drasil.Quantities.PhysicalProperties (mass)

import Drasil.SWHS.DataDefs (waterMass, tankVolume, balanceDecayRate)
import Drasil.SWHS.Requirements (calcTempWtrOverTime, calcChgHeatEnergyWtrOverTime,
  checkWithPhysConsts, findMassConstruct, inReqDesc, oIDQConstruct)

import Drasil.NoPCM.DataDefs (waterVolume)
import Drasil.NoPCM.IMods (eBalanceOnWtr)
import Drasil.NoPCM.Unitals (inputs)

--------------------------
--Section 5 : REQUIREMENTS
--------------------------

---------------------------------------
--Section 5.1 : FUNCTIONAL REQUIREMENTS
---------------------------------------

--
inputInitVals :: ConceptInstance
inputInitVals :: ConceptInstance
inputInitVals = String -> Sentence -> String -> ConceptChunk -> ConceptInstance
forall c.
Concept c =>
String -> Sentence -> String -> c -> ConceptInstance
cic "inputInitVals" ([Sentence] -> Sentence
foldlSent [
  NamedChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize NamedChunk
input_, String -> Sentence
S "the following", NamedChunk -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
plural NamedChunk
value, String -> Sentence
S "described in the table for",
  LabelledContent -> Sentence -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef LabelledContent
inputInitValsTable (String -> Sentence
S "Required Inputs")Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S "which define", Sentence
inReqDesc])
  "Input-Initial-Values" ConceptChunk
funcReqDom

--
findMass :: ConceptInstance
findMass :: ConceptInstance
findMass = ConceptInstance
-> Sentence
-> [InstanceModel]
-> [DataDefinition]
-> ConceptInstance
forall r s t.
(Referable r, HasShortName r, Referable s, HasShortName s,
 Referable t, HasShortName t) =>
r -> Sentence -> [s] -> [t] -> ConceptInstance
findMassConstruct ConceptInstance
inputInitVals (UnitalChunk -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
phrase UnitalChunk
mass) [InstanceModel
eBalanceOnWtr]
            [DataDefinition
waterMass, DataDefinition
waterVolume, DataDefinition
tankVolume]

--
oIDQVals :: [Sentence]
oIDQVals :: [Sentence]
oIDQVals = ([Sentence] -> Sentence) -> [[Sentence]] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map [Sentence] -> Sentence
foldlSent_ [
  [NP -> Sentence
forall n. NounPhrase n => n -> Sentence
pluralNP (NamedChunk -> NP
forall t. NamedIdea t => t -> NP
the NamedChunk
value), ConceptInstance -> Sentence
forall r. (Referable r, HasShortName r) => r -> Sentence
fromSource ConceptInstance
inputInitVals],
  [NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (UnitalChunk -> NP
forall t. NamedIdea t => t -> NP
the UnitalChunk
mass), ConceptInstance -> Sentence
forall r. (Referable r, HasShortName r) => r -> Sentence
fromSource ConceptInstance
findMass],
  [DataDefinition -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch DataDefinition
balanceDecayRate, DataDefinition -> Sentence
forall r. (Referable r, HasShortName r) => r -> Sentence
fromSource DataDefinition
balanceDecayRate]
  ]

inputInitValsTable :: LabelledContent
inputInitValsTable :: LabelledContent
inputInitValsTable = [QuantityDict] -> ConceptInstance -> LabelledContent
forall i r.
(Quantity i, MayHaveUnit i, HasShortName r, Referable r) =>
[i] -> r -> LabelledContent
mkInputPropsTable [QuantityDict]
inputs ConceptInstance
inputInitVals

funcReqs :: [ConceptInstance]
funcReqs :: [ConceptInstance]
funcReqs = [ConceptInstance
inputInitVals, ConceptInstance
findMass, ConceptInstance
checkWithPhysConsts,
        [Sentence] -> ConceptInstance
oIDQConstruct [Sentence]
oIDQVals, ConceptInstance
calcTempWtrOverTime, ConceptInstance
calcChgHeatEnergyWtrOverTime]

-------------------------------------------
--Section 5.2 : NON-FUNCTIONAL REQUIREMENTS
-------------------------------------------

--imports from SWHS