module Drasil.DblPend.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.DblPend.IMods (angleIM_1, angleIM_2)
import Drasil.DblPend.Unitals (pendDisAngle_1, pendDisAngle_2)

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

verifyInptVals, calcAng, outputValues :: ConceptInstance

verifyInptVals :: ConceptInstance
verifyInptVals = forall c.
Concept c =>
String -> Sentence -> String -> c -> ConceptInstance
cic String
"verifyInptVals" Sentence
verifyInptValsDesc  String
"Verify-Input-Values"    ConceptChunk
funcReqDom
calcAng :: ConceptInstance
calcAng        = forall c.
Concept c =>
String -> Sentence -> String -> c -> ConceptInstance
cic String
"calcAng"        Sentence
calcAngDesc         String
"Calculate-Angle-Of-Rod" ConceptChunk
funcReqDom
outputValues :: ConceptInstance
outputValues   = forall c.
Concept c =>
String -> Sentence -> String -> c -> ConceptInstance
cic String
"outputValues"   Sentence
outputValuesDesc    String
"Output-Values"          ConceptChunk
funcReqDom

verifyInptValsDesc, calcAngDesc, outputValuesDesc :: Sentence

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

calcAngDesc :: Sentence
calcAngDesc = [Sentence] -> Sentence
foldlSent [String -> Sentence
S String
"Calculate the following" Sentence -> Sentence -> Sentence
+: forall n. NamedIdea n => n -> Sentence
plural IdeaDict
value Sentence -> Sentence -> Sentence
+:+ Sentence
outputList]
outputValuesDesc :: Sentence
outputValuesDesc = [Sentence] -> Sentence
foldlSent [forall n. NamedIdea n => n -> Sentence
atStart IdeaDict
output_ Sentence -> Sentence -> Sentence
+:+ Sentence
outputList]

outputList :: Sentence
outputList :: Sentence
outputList = forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
pendDisAngle_1 Sentence -> Sentence -> Sentence
`S.and_` forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
pendDisAngle_2 Sentence -> Sentence -> Sentence
+:+
    Sentence -> Sentence
sParen (String -> Sentence
S String
"from" Sentence -> Sentence -> Sentence
+:+ forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS InstanceModel
angleIM_1 Sentence -> Sentence -> Sentence
`S.and_` forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS InstanceModel
angleIM_2)

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

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

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