#import "data/config.typ": *
#import "data/theme.typ": *
#import "data/cover.typ": cover-page
#import "data/toc.typ": toc-page, toc-register-chapter-counter
#import "data/body.typ": report-body, start-body-page-numbering
#import "data/diagrams.typ": ore-sorting-flow
#import "data/code.typ": codly-init-rule, codly-config, code-token-highlight-init
#import "data/md.typ": load-report-md, parse-report-date

#show: codly-init-rule
#show: code-token-highlight-init
#codly-config

#let report = load-report-md(
  read(content-path),
  source-path: content-path,
  extra-scope: (
    ore-sorting-flow: ore-sorting-flow,
  ),
)
#let meta = report.metadata
#let report-date = parse-report-date(meta.date)

#cover-page(meta, date: report-date)

#show: report-body.with(
  title: meta.title,
  author: meta.brand,
  date: report-date,
  body-font: body-font,
  heading-font: heading-font,
  raw-font: mono-font,
  font-size: size-body,
  leading-ratio: leading-ratio,
  margin-x: body-margin-x,
  margin-y: body-margin-y,
)

#set heading(numbering: "1.1.1.1")
#show: toc-register-chapter-counter()

#toc-page(meta)

#if meta.summary != "" [
  #v(summary-top-offset, weak: false)
  #meta.summary
  #v(summary-body-gap)
]

#start-body-page-numbering()

#report.body
