|
- namespace Campaign_Tracker.Server.ExtensionData;
-
- /// <summary>
- /// Immutable value object that an extension record stores as its required legacy foreign reference.
- /// Carry the <see cref="LegacyLinkType"/> and the string representation of the join key so
- /// the anti-corruption layer can resolve it unambiguously (AC #2).
- /// </summary>
- public sealed record LegacyLinkReference(LegacyLinkType Type, string Value)
- {
- public static LegacyLinkReference ForJurisdiction(string jCode)
- {
- ArgumentException.ThrowIfNullOrWhiteSpace(jCode);
- return new(LegacyLinkType.JurisdictionJCode, jCode);
- }
-
- public static LegacyLinkReference ForKit(int id) =>
- new(LegacyLinkType.KitId, id.ToString(System.Globalization.CultureInfo.InvariantCulture));
-
- public static LegacyLinkReference ForContact(int id) =>
- new(LegacyLinkType.ContactId, id.ToString(System.Globalization.CultureInfo.InvariantCulture));
-
- public override string ToString() => $"{Type}:{Value}";
- }
|