/**
 * Frontend route parameter validation helpers (RHL-021).
 *
 * Conventions:
 * - branch: "NL" + digits (e.g. NL01, NL200) - existence is validated separately for admin/dev
 * - year:  "YYYY"
 * - month: "MM" (01-12)
 * - day:   "DD" (01-31)
 */

const BRANCH_RE = /^NL\d+$/;
const YEAR_RE = /^\d{4}$/;
const MONTH_RE = /^(0[1-9]|1[0-2])$/;
const DAY_RE = /^(0[1-9]|[12]\d|3[01])$/;

export function isValidBranchParam(value) {
	return typeof value === "string" && BRANCH_RE.test(value);
}

export function isValidYearParam(value) {
	return typeof value === "string" && YEAR_RE.test(value);
}

export function isValidMonthParam(value) {
	return typeof value === "string" && MONTH_RE.test(value);
}

export function isValidDayParam(value) {
	return typeof value === "string" && DAY_RE.test(value);
}
