module Text.Fountain.Types where

import           Data.HashMap.Strict (HashMap)
import           Data.Text (Text)
import qualified Data.Text as T

data Doc = Doc
  { ftTitle   :: Maybe Title
  , ftContent :: [Element]
  } deriving (Eq, Read, Show)

data Title = Title { unFtTitle :: HashMap String Markup }
  deriving (Eq, Read, Show)

type SceneNumber = Int

type Markup = [Inline]

data Inline
  = IStr Text
  | IEmph Markup
  | IStrong Markup
  | IUnderline Markup
    deriving (Eq, Read, Show)

data Element
  = ElSceneHeading Markup SceneNumber
  | ElDialogue DialogueElement
  | ElTransition Markup
  | ElLyric Markup
  | ElAction Markup Bool
  | ElCentered Markup
    deriving (Eq, Read, Show)

type DialogueText = [DialogueElement]

data DialogueElement = DialogueElement
  { deCharacter     :: Markup
  , deParenthetical :: Maybe Markup
  , deDialogue      :: Markup
  , deConcurrent    :: Maybe DialogueElement
  } deriving (Eq, Read, Show)

data FromFountain t = FromFountain
  { fromScene         :: Markup -> SceneNumber -> [t]
  , fromDialogue      :: DialogueText          -> [t]
  , fromLyric         :: Markup                -> [t]
  , fromTransition    :: Markup                -> [t]
  , fromAction        :: Inline                -> [t]
  }
