// Internal memo (MEM): a note to the team. To, from, subject, and the
// point, on the compact letterhead used for internal papers, under the
// INTERNAL watermark so a stray copy is plainly not for circulation.
//
// The sample moves leave requests to an HR portal. The people, dates and
// details are examples: replace every one.
//
// Edit only the data block. A fact that isn't known stays `none` and
// prints as a blank. Optional parts (copies, the change table, the action)
// are left out when they are `none` or empty.

#import "../rivant.typ": *

// ---------------------------------------------------------------- data

#let data = (
  // The next number in the memo register (MEM) for this financial year.
  // none prints a blank in its place.
  seq: 9,
  // The date of the memo, written YYYY-MM-DD.
  date: "2026-09-12",
  // Who it is from: the person, and their designation for the sign-off.
  // Paras Deshpande, Managing Director & CEO, for HR, legal and finance
  // (such as this change to how leave is asked for); Arnuv Amburle,
  // Executive Director & COO, for operations, projects and internal
  // processes.
  from: (name: "Paras Deshpande", title: "Managing Director & CEO"),
  // Who it is for: a person, a team, or "All team members".
  to: "All team members",
  // Anyone copied in, as one line ("Team leads; HR"). none leaves the
  // field out.
  cc: none,
  // The subject as a title: the heavy words first, then the rest in the
  // light italic. title-light can be none.
  title: "Leave requests",
  title-light: "move to the HR portal",
  // The point, in a paragraph or two. Blank line between paragraphs.
  body: [
    From 1 October 2026, every leave request goes through the HR portal
    instead of email. Your leave balance, your team's calendar and each
    approval will all be in one place, so nobody has to ask HR how many
    days they have left.

    Leave already approved by email stands. Nothing changes in the leave
    policy itself: the number of days, carry-forward and notice stay as
    they are.
  ],
  // What changes, as rows of (what, until, from). () leaves the table out.
  changes-head: ("", "Until 30 September", "From 1 October"),
  changes: (
    ("Asking for leave", "Email your team lead", "Apply in the portal, under Leave"),
    ("Approval", "Your lead replies by email", "Your lead approves in the portal"),
    ("Your balance", "Ask HR", "Shown on your portal home page"),
    ("Sick leave", "Tell your lead the same day", "Tell your lead, then log it within two days"),
  ),
  // The one thing each reader has to do, and by when. none leaves the
  // panel out.
  action: [
    Sign in to the portal with your rivant.in account and check that your
    leave balance matches your own records. Tell HR of any difference.
  ],
  action-by: "2026-09-30",
  // Where questions go.
  questions: [Questions go to your team lead, or to HR in person.],
  // "internal" for anything that mustn't leave the company; none for a
  // memo that may; "draft" until it's final.
  watermark: "internal",
)

// -------------------------------------------------------------- layout

#let k = document-kinds.at("memo")

#show: rivant-document.with(
  kind: k.name,
  title: data.title,
  title-light: data.title-light,
  reference: ref-no(k.code, data.seq, date: data.date),
  date: data.date,
  meta: (
    ("From", data.from.name),
    ("To", data.to),
    ..if data.cc != none { (("Copy to", data.cc),) } else { () },
  ),
  letterhead: k.letterhead,
  watermark: data.watermark,
)

#block(text(size: sizes.lead, data.body))

#if data.changes.len() > 0 {
  data-table(
    columns: (32mm, 1fr, 1fr),
    header: data.changes-head,
    align: (left, left, left),
    rows: data.changes.map(((what, before, after)) => (text(weight: 600, what), muted(before), after)),
  )
}

#if data.action != none {
  callout(title: [Action required by #long-date(data.action-by, field: "Action by")], data.action)
}

#data.questions

// A memo is initialled, not signed for the company: the author's name and
// designation close it.
#block(above: 10mm, breakable: false, {
  set par(leading: 0.6em)
  text(weight: 600, or-blank(data.from.name, "Name"))
  linebreak()
  muted(or-blank(data.from.title, "Designation"))
})
