% Mail Merge Letter Template
% Use with mail_merge.py script and a CSV/JSON data source.
%
% Placeholder syntax:
%   Simple mode:  {{variable_name}}  -- auto-escaped for LaTeX
%   Jinja2 mode:  << variable_name >> -- uses <% %> for blocks
%
% This template uses SIMPLE MODE ({{...}} placeholders).
% For advanced features (conditionals, loops), use Jinja2 mode with << >> delimiters.
%
% Example CSV data source (data.csv):
%   name,title,company,address,city,state,zip,salutation,position
%   John Smith,Mr.,Acme Inc,123 Main St,Springfield,IL,62701,Dear Mr. Smith,Senior Engineer
%
% Usage:
%   python3 scripts/mail_merge.py mail-merge-letter.tex data.csv --output-dir ./outputs
%
\documentclass[11pt,a4paper]{article}

\usepackage[margin=1in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage[colorlinks=true, linkcolor=blue!70!black, urlcolor=blue!70!black]{hyperref}

% === Company Colors ===
\definecolor{headerBlue}{RGB}{0, 51, 102}
\definecolor{accentGold}{RGB}{180, 140, 50}

% === Header with company branding ===
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[L]{%
    \textcolor{headerBlue}{\textbf{\large Acme Corporation}}\\
    \textcolor{gray}{\small 456 Business Ave, Suite 100, New York, NY 10001}\\
    \textcolor{gray}{\small Tel: (555) 123-4567 \quad Email: info@acme.com}
}
\fancyfoot[C]{\small\textcolor{gray}{\thepage}}

\begin{document}

\vspace*{1.5cm}

% === Date ===
\noindent\today

\vspace{1cm}

% === Recipient Address ===
\noindent
{{title}} {{name}}\\
{{company}}\\
{{address}}\\
{{city}}, {{state}} {{zip}}

\vspace{1cm}

% === Salutation ===
\noindent {{salutation}},

\vspace{0.5cm}

% === Letter Body ===
\noindent
I am writing to confirm your appointment as {{position}} at Acme Corporation,
effective immediately. We are delighted to welcome you to our team and look
forward to your contributions to our organization.

As discussed during your interview process, your role will involve leading
key initiatives within our {{company}} division. Your experience and expertise
make you an excellent fit for this position, and we are confident in your
ability to drive meaningful results.

Please find enclosed your employment agreement and onboarding materials.
We kindly request that you review and sign the agreement by the end of this
month. If you have any questions, please do not hesitate to contact our
Human Resources department.

We look forward to working with you.

\vspace{1cm}

% === Closing ===
\noindent
Sincerely,

\vspace{1cm}

\noindent
\textbf{Sarah Johnson}\\
Director of Human Resources\\
Acme Corporation\\
\href{mailto:sjohnson@acme.com}{sjohnson@acme.com}

\end{document}
