//! Checklist domain — flattens procedures into printable checklists.
//!
//! The checklist domain model is relatively flat: sections with headings,
//! steps with checkboxes, response options, and limited nesting. Role
//! assignments are inherited downward (an `@surgeon` scope annotates its
//! child steps) rather than forming structural containers.

use crate::domain::checklist::adapter::ChecklistAdapter;
use crate::domain::serialize::{Markup, Render};
use crate::domain::Adapter;
use crate::language;
use crate::templating::template::Template;

pub static TEMPLATE: &str = include_str!("checklist.typ");

pub struct Checklist;

impl Template for Checklist {
    fn markup(&self, document: &language::Document) -> String {
        let model = ChecklistAdapter.extract(document);
        let mut out = Markup::new();
        model.render(&mut out);
        out.finish()
    }

    fn typst(&self) -> &str {
        TEMPLATE
    }

    fn domain(&self) -> &str {
        "checklist"
    }
}
