module Drasil.DblPendulum.Requirements where

import Language.Drasil
import Drasil.DocLang.SRS (datCon, propCorSol)
import Language.Drasil.Chunk.Concept.NamedCombinators
import qualified Language.Drasil.Sentence.Combinators as S
import Data.Drasil.Concepts.Computation (inValue)
import Data.Drasil.Concepts.Documentation (datumConstraint, funcReqDom,
        output_, value,  nonFuncReqDom, code, environment, propOfCorSol)
--  likelyChg, mg, mis, module_, nonFuncReqDom,
--   requirement, srs, traceyMatrix, unlikelyChg, value, vavPlan)
import Data.Drasil.Concepts.Math (calculation)
import Data.Drasil.Concepts.Software (errMsg)
import Drasil.DblPendulum.IMods (angularAccelIM_1, angularAccelIM_2)
import Drasil.DblPendulum.Unitals (angularAccel_1, angularAccel_2)

--Functional Requirements--
funcReqs :: [ConceptInstance]
funcReqs :: [ConceptInstance]
funcReqs = [ConceptInstance
verifyInptVals, ConceptInstance
calcAngPos, ConceptInstance
outputValues]

verifyInptVals, calcAngPos, outputValues :: ConceptInstance

verifyInptVals :: ConceptInstance
verifyInptVals = String -> Sentence -> String -> ConceptChunk -> ConceptInstance
forall c.
Concept c =>
String -> Sentence -> String -> c -> ConceptInstance
cic "verifyInptVals" Sentence
verifyInptValsDesc  "Verify-Input-Values"                 ConceptChunk
funcReqDom
calcAngPos :: ConceptInstance
calcAngPos     = String -> Sentence -> String -> ConceptChunk -> ConceptInstance
forall c.
Concept c =>
String -> Sentence -> String -> c -> ConceptInstance
cic "calcAngPos"     Sentence
calcAngPosDesc      "Calculate-Angular-Position-Of-Mass"  ConceptChunk
funcReqDom
outputValues :: ConceptInstance
outputValues   = String -> Sentence -> String -> ConceptChunk -> ConceptInstance
forall c.
Concept c =>
String -> Sentence -> String -> c -> ConceptInstance
cic "outputValues"   Sentence
outputValuesDesc    "Output-Values"                       ConceptChunk
funcReqDom

verifyInptValsDesc, calcAngPosDesc, outputValuesDesc :: Sentence

verifyInptValsDesc :: Sentence
verifyInptValsDesc = [Sentence] -> Sentence
foldlSent [String -> Sentence
S "Check the entered", NamedChunk -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
plural NamedChunk
inValue,
  String -> Sentence
S "to ensure that they do not exceed the" Sentence -> Sentence -> Sentence
+:+. Section -> Sentence -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef ([Contents] -> [Section] -> Section
datCon ([]::[Contents]) ([]::[Section])) (NamedChunk -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
plural NamedChunk
datumConstraint),
  String -> Sentence
S "If any of the", NamedChunk -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
plural NamedChunk
inValue, String -> Sentence
S "are out of bounds" Sentence -> Sentence -> Sentence
`sC`
  String -> Sentence
S "an", ConceptChunk -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
phrase ConceptChunk
errMsg, String -> Sentence
S "is displayed" Sentence -> Sentence -> Sentence
`S.andThe` ConceptChunk -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
plural ConceptChunk
calculation, String -> Sentence
S "stop"]

calcAngPosDesc :: Sentence
calcAngPosDesc = [Sentence] -> Sentence
foldlSent [String -> Sentence
S "Calculate the following" Sentence -> Sentence -> Sentence
+: NamedChunk -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
plural NamedChunk
value,
  UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
angularAccel_1 Sentence -> Sentence -> Sentence
`S.and_` UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
angularAccel_2,
  Sentence -> Sentence
sParen (String -> Sentence
S "from" Sentence -> Sentence -> Sentence
+:+ InstanceModel -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS InstanceModel
angularAccelIM_1),
  Sentence -> Sentence
sParen (String -> Sentence
S "from" Sentence -> Sentence -> Sentence
+:+ InstanceModel -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS InstanceModel
angularAccelIM_2)]
outputValuesDesc :: Sentence
outputValuesDesc = [Sentence] -> Sentence
foldlSent [NamedChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
atStart NamedChunk
output_, UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
angularAccel_1 Sentence -> Sentence -> Sentence
`S.and_` UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
angularAccel_2,
  Sentence -> Sentence
sParen (String -> Sentence
S "from" Sentence -> Sentence -> Sentence
+:+ InstanceModel -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS InstanceModel
angularAccelIM_1 Sentence -> Sentence -> Sentence
`S.and_` InstanceModel -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS InstanceModel
angularAccelIM_2)]

--Nonfunctional Requirements--
nonFuncReqs :: [ConceptInstance]
nonFuncReqs :: [ConceptInstance]
nonFuncReqs = [ConceptInstance
correct, ConceptInstance
portable]

correct :: ConceptInstance
correct :: ConceptInstance
correct = String -> Sentence -> String -> ConceptChunk -> ConceptInstance
forall c.
Concept c =>
String -> Sentence -> String -> c -> ConceptInstance
cic "correct" ([Sentence] -> Sentence
foldlSent [
 NP -> Sentence
forall n. NounPhrase n => n -> Sentence
atStartNP' (NamedChunk
output_ NamedChunk -> NamedChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`the_ofThePS` NamedChunk
code), String -> Sentence
S "have the", 
 Section -> Sentence -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef ([Contents] -> [Section] -> Section
propCorSol [] []) (NamedChunk -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
plural NamedChunk
propOfCorSol)]
 ) "Correct" ConceptChunk
nonFuncReqDom

portable :: ConceptInstance
portable :: ConceptInstance
portable = String -> Sentence -> String -> ConceptChunk -> ConceptInstance
forall c.
Concept c =>
String -> Sentence -> String -> c -> ConceptInstance
cic "portable" ([Sentence] -> Sentence
foldlSent [
  NP -> Sentence
forall n. NounPhrase n => n -> Sentence
atStartNP (NamedChunk -> NP
forall t. NamedIdea t => t -> NP
the NamedChunk
code), String -> Sentence
S "is able to be run in different", NamedChunk -> Sentence
forall n. (HasUID n, NamedIdea n) => n -> Sentence
plural NamedChunk
environment])
  "Portable" ConceptChunk
nonFuncReqDom