feat: provinces and municipalities from the ISTAT list in the base data (#45)

New companies now get the 110 provinces and 7,894 municipalities in force
(ISTAT list of 26/02/2026, CC BY 4.0), so the tax code calculation and the
municipality lookups work without loading anything. The list lives in the
Italian pack behind a new IPlaceDirectory feature and is added by the base
seeder like the rest of the base data: missing codes only, never touching
existing rows. The pack data version moves to IT 2026.3 so existing
companies receive the lists at the next start.

Postal codes are left out: the only candidate source (comuni-json) has no
licence for them and stops at 2020 (ADR 0028).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-12 09:07:12 +01:00
1 parent 07555de700
commit 321aae7e81
19 files changed
+8249 -25

No files matched your search

@@ -240,3 +240,34 @@ public interface IBaseTablesTemplate
/// <summary>The document types.</summary>
IReadOnlyList<DocumentTypeTemplate> DocumentTypes { get; }
}
/// <summary>A province (or equivalent first-level area) of the country's official list.</summary>
/// <param name="Code">The abbreviation, such as <c>TO</c>.</param>
/// <param name="Name">The name.</param>
/// <param name="Region">The region.</param>
public sealed record ProvinceTemplate(string Code, string Name, string Region);
/// <summary>A municipality of the country's official list.</summary>
/// <param name="Code">The code used by the tax rules (the Italian cadastral code, such as <c>L219</c>).</param>
/// <param name="Name">The name.</param>
/// <param name="ProvinceCode">The province (a <see cref="ProvinceTemplate.Code"/>).</param>
/// <param name="Region">The region.</param>
/// <param name="StatisticalCode">The code of the national statistics office, if any.</param>
/// <param name="PostalCodes">The postal codes, comma separated, when the list has them.</param>
public sealed record MunicipalityTemplate(string Code, string Name, string ProvinceCode, string Region, string? StatisticalCode, string? PostalCodes);
/// <summary>
/// The official list of provinces and municipalities shipped with the pack, loaded into the base tables (ADR 0026,
/// ADR 0028). Like the rest of the base data it only adds the codes a company is missing.
/// </summary>
public interface IPlaceDirectory
{
/// <summary>Where the list comes from and its date, shown in the documentation and the logs.</summary>
string Source { get; }
/// <summary>The provinces.</summary>
IReadOnlyList<ProvinceTemplate> Provinces { get; }
/// <summary>The municipalities.</summary>
IReadOnlyList<MunicipalityTemplate> Municipalities { get; }
}