#import "cv/cv.typ": *
#import "cv/utils.typ"

#let render(language) = {
  let cvdata = utils.filterLanguage(language, (
    personal: yaml("data/personal.yaml"),
    experience: yaml("data/experience.yaml"),
    education: yaml("data/education.yaml"),
    skills: yaml("data/skills.yaml"),
    languages: yaml("data/languages.yaml"),
  ))

  let uservars = (
    headingfont: "Roboto",
    bodyfont: "Roboto",
    fontsize: 10pt, // 10pt, 11pt, 12pt
    linespacing: 6pt,
    showAddress: true, // true/false show address in contact info
    showNumber: true, // true/false show phone number in contact info
    headingsmallcaps: false,
  )

  let customrules(doc) = {
    // add custom document style rules here
    set page(
      paper: "a4", // a4, us-letter
      // numbering: "1 / 1",
      number-align: center, // left, center, right
      margin: 1.25cm, // 1.25cm, 1.87cm, 2.5cm
    )

    doc
  }

  let cvinit(doc) = {
    doc = setrules(uservars, doc)
    doc = showrules(uservars, doc)
    doc = customrules(doc)

    doc
  }

  show: doc => cvinit(doc)

  cvheading(language, cvdata, uservars)
  cvwork(language, cvdata)
  cveducation(language, cvdata)
  cvlanguages(language, cvdata)
  cvskills(language, cvdata)
  endnote()
}