use crate::rich_string::RichString;
#[derive(Debug, PartialEq, Eq, Clone, Hash, Default)]
pub struct Screenplay {
pub titlepage: Option<TitlePage>,
pub elements: Vec<Element>,
}
impl Screenplay {
pub fn new(titlepage: Option<TitlePage>, elements: Vec<Element>) -> Self {
Self {
titlepage,
elements,
}
}
pub fn set_titlepage(&mut self, titlepage: Option<TitlePage>) {
self.titlepage = titlepage;
}
}
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
pub enum Element {
Heading {
slug: RichString,
number: Option<String>,
},
Action(RichString),
Dialogue(Dialogue),
DualDialogue(Dialogue, Dialogue),
Lyrics(RichString),
Transition(RichString),
CenteredText(RichString),
Synopsis(RichString),
PageBreak,
}
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
pub struct Dialogue {
pub character: RichString,
pub extension: Option<RichString>,
pub elements: Vec<DialogueElement>,
}
impl Dialogue {
pub fn new() -> Self {
Self {
character: RichString::new(),
extension: None,
elements: Vec::new(),
}
}
}
impl Default for Dialogue {
fn default() -> Self {
Self::new()
}
}
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
pub enum DialogueElement {
Parenthetical(RichString),
Line(RichString),
}
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
pub struct TitlePage {
pub title: Vec<RichString>,
pub credit: Vec<RichString>,
pub authors: Vec<RichString>,
pub source: Vec<RichString>,
pub draft_date: Vec<RichString>,
pub contact: Vec<RichString>,
}
impl TitlePage {
pub fn new() -> Self {
Self {
title: Vec::new(),
credit: Vec::new(),
authors: Vec::new(),
source: Vec::new(),
draft_date: Vec::new(),
contact: Vec::new(),
}
}
}
impl Default for TitlePage {
fn default() -> Self {
Self::new()
}
}