using EntitlementDAL.DTOs; using GB5Shared.DTO.Framework.Login; namespace EntitlementBLL.Legal; /// Interim authoring surface for Phase 0's Entitlement-owned MAGREEMENTTYPE/ /// MAGREEMENTVERSION schema (tracker §50/§51) — deliberately temporary: once the full "GoodBooks /// CLM" product ships (its own future session), this interim schema and its authoring surface /// are retired, and content authoring moves to CLM's own admin UI. Not part of /// IAgreementConsentProvider — that interface is the consumption-side boundary meant to survive /// the swap to a real CLM client; authoring does not need to survive it. public interface IAgreementAuthoringBLL { /// Creates an agreement type (e.g. "TOS"/"PRIVACYPOLICY"/"AUP"/"EULA"/"DPA") if one /// with the same TypeCode doesn't already exist. Idempotent — safe to call repeatedly with /// the same TypeCode. Task EnsureTypeAsync(string typeCode, string typeName, bool requiresIndividualAcceptance, LoginDTO login, CancellationToken ct); /// Admin authoring list (tracker §51.13) — every real agreement type. Task> GetTypeListAsync(LoginDTO login, CancellationToken ct); /// Admin authoring list (tracker §51.13) — full Draft/Published/Superseded/Retired /// history for one type, newest first. Task> GetVersionListByTypeAsync(int agreementTypeId, LoginDTO login, CancellationToken ct); /// Creates a new Draft version. Always creates a new row — versions are never /// updated in place once they exist, only their VersionStatus transitions /// (Draft→Published→Superseded/Retired). Task CreateDraftVersionAsync( string typeCode, string versionLabel, string? jurisdictionCode, string? contentRef, DateTime effectiveFrom, LoginDTO login, CancellationToken ct); /// Draft → Published. Immutable once Published — mirrors UpgradePackageBLL.Save's /// own already-proven guard. Computes and stores ContentHash (SHA-256 of ContentRef) at /// publish time, not at draft time, since ContentRef may still change while Draft. Task PublishVersionAsync(int agreementVersionId, LoginDTO login, CancellationToken ct); /// Published → Superseded — used when a newer version of the same type/jurisdiction /// replaces this one. Does not retroactively affect any LAGREEMENTACCEPTANCE row already /// recorded against it — those rows remain valid, permanent proof of what was accepted at /// the time. Task SupersedeVersionAsync(int agreementVersionId, LoginDTO login, CancellationToken ct); }