/**
 * Defra organisations carry an abbreviation suffix on the enum value, e.g.
 * "Rural Payments Agency – RPA". The unavailable page reads cleanly without it.
 */
function stripOrgSuffix(organisation) {
  return organisation.split(' – ')[0];
}
function splitPhoneLines(phone) {
  if (!phone) return undefined;
  const lines = phone.split('\n').map(line => line.trim()).filter(line => line.length > 0);
  return lines.length > 0 ? lines : undefined;
}
export function unavailableViewModel(metadata) {
  return {
    pageTitle: 'Sorry, this form is unavailable',
    formTitle: metadata.title,
    organisationName: stripOrgSuffix(metadata.organisation),
    phoneLines: splitPhoneLines(metadata.contact?.phone)
  };
}
//# sourceMappingURL=unavailable-view-model.js.map