module Drasil.DblPend.Requirements where

import Language.Drasil
import Drasil.DocLang.SRS (datCon)
import Drasil.DocLang (mkPortableNFR, mkCorrectNFR)
import qualified Language.Drasil.Sentence.Combinators as S

import Data.Drasil.Concepts.Computation (inValue)
import Data.Drasil.Concepts.Documentation (datumConstraint, funcReqDom,
        output_, value)
--  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 = String -> Sentence -> String -> ConceptChunk -> ConceptInstance
forall c.
Concept c =>
String -> Sentence -> String -> c -> ConceptInstance
cic String
"verifyInptVals" Sentence
verifyInptValsDesc  String
"Verify-Input-Values"    ConceptChunk
funcReqDom
calcAng :: ConceptInstance
calcAng        = String -> Sentence -> String -> ConceptChunk -> ConceptInstance
forall c.
Concept c =>
String -> Sentence -> String -> c -> ConceptInstance
cic String
"calcAng"        Sentence
calcAngDesc         String
"Calculate-Angle-Of-Rod" ConceptChunk
funcReqDom
outputValues :: ConceptInstance
outputValues   = String -> Sentence -> String -> ConceptChunk -> ConceptInstance
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", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
plural IdeaDict
inValue,
  String -> Sentence
S String
"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])) (IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
plural IdeaDict
datumConstraint),
  String -> Sentence
S String
"If any of the", IdeaDict -> Sentence
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", ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
errMsg, String -> Sentence
S String
"is displayed" Sentence -> Sentence -> Sentence
`S.andThe` ConceptChunk -> Sentence
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
+: IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
plural IdeaDict
value Sentence -> Sentence -> Sentence
+:+ Sentence
outputList]
outputValuesDesc :: Sentence
outputValuesDesc = [Sentence] -> Sentence
foldlSent [IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
atStart IdeaDict
output_ Sentence -> Sentence -> Sentence
+:+ Sentence
outputList]

outputList :: Sentence
outputList :: Sentence
outputList = UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
pendDisAngle_1 Sentence -> Sentence -> Sentence
`S.and_` UnitalChunk -> Sentence
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
+:+ InstanceModel -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS InstanceModel
angleIM_1 Sentence -> Sentence -> Sentence
`S.and_` InstanceModel -> Sentence
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 = String -> String -> ConceptInstance
mkCorrectNFR String
"correct" String
"Correctness"

portable :: ConceptInstance
portable :: ConceptInstance
portable = String -> [String] -> String -> ConceptInstance
mkPortableNFR String
"portable" [String
"Windows", String
"Mac OSX", String
"Linux"] String
"Portability"