namespace EntitlementDAL.DTOs;
/// Who a subject-type/subject-id pair on LAGREEMENTACCEPTANCE resolves against.
/// Prospect/Customer both key SubjectId off the same central MCLIENT.ClientId — kept as two
/// distinct values (rather than reusing Prospect throughout) purely so a real audit read can
/// tell "accepted at signup" apart from "accepted at the moment of paying" without inspecting
/// CorrelationKey text. Vendor/Partner/Bidder are reserved for CLM's future bilateral-agreement
/// scope (tracker §51) — LocalAgreementConsentProvider (Phase 0) only ever writes
/// Prospect/ClientAdmin/EndUser/Customer.
public enum AgreementSubjectType : byte
{
Prospect = 0,
ClientAdmin = 1,
EndUser = 2,
Vendor = 3,
Partner = 4,
Bidder = 5,
/// The central account at the moment of a real commercial transaction (subscription
/// purchase/upgrade/renewal payment) — tracker §51.10's own "buying" consent gate.
Customer = 6,
}
/// How a subject indicated acceptance. WetSignature/ESignature/CounterSignature are
/// reserved for CLM's future real e-signature integration (tracker §51.3 Phase 4) — nothing
/// built in this pass can ever produce those values.
public enum AgreementAcceptanceMethod : byte
{
Checkbox = 0,
Clickwrap = 1,
WetSignature = 2,
ESignature = 3,
CounterSignature = 4,
}
/// MAGREEMENTVERSION.VERSIONSTATUS — immutable once Published (BLL-enforced), mirrors
/// the same rule this engagement already enforces on SW.MSWUPGRADEPACKAGE.
public enum AgreementVersionStatus : byte
{
Draft = 0,
Published = 1,
Superseded = 2,
Retired = 3,
}
public class AgreementTypeDTO
{
public int AgreementTypeId { get; set; }
public string TypeCode { get; set; } = string.Empty;
public string TypeName { get; set; } = string.Empty;
public bool RequiresIndividualAcceptance { get; set; }
public short Version { get; set; }
public byte Status { get; set; } = 1;
public int SortOrder { get; set; }
public int CreatedById { get; set; }
public DateTime CreatedOn { get; set; }
public int ModifiedById { get; set; }
public DateTime ModifiedOn { get; set; }
public byte SourceType { get; set; }
}
public class AgreementVersionDTO
{
public int AgreementVersionId { get; set; }
public int AgreementTypeId { get; set; }
public string VersionLabel { get; set; } = string.Empty;
public string? JurisdictionCode { get; set; }
public int LanguageId { get; set; } = -1;
public string? ContentRef { get; set; }
public string? ContentHash { get; set; }
public DateTime EffectiveFrom { get; set; }
public byte VersionStatus { get; set; }
// Reserved for CLM's future bilateral-agreement scope — unused/unread by anything built
// in this pass (see the migration's own header comment).
public byte? CounterpartyType { get; set; }
public int? CounterpartyRef { get; set; }
public short Version { get; set; }
public byte Status { get; set; } = 1;
public int SortOrder { get; set; }
public int CreatedById { get; set; }
public DateTime CreatedOn { get; set; }
public int ModifiedById { get; set; }
public DateTime ModifiedOn { get; set; }
public byte SourceType { get; set; }
}
/// One append-only row per acceptance — never updated after insert.
public class AgreementAcceptanceDTO
{
public int AgreementAcceptanceId { get; set; }
public byte SubjectType { get; set; }
public int SubjectId { get; set; }
public int AgreementVersionId { get; set; }
public DateTime AcceptedOn { get; set; }
public string? IpAddress { get; set; }
public string? UserAgent { get; set; }
public byte AcceptanceMethod { get; set; }
public string? CorrelationKey { get; set; }
public int? CounterSignedByUserId { get; set; }
public int CreatedById { get; set; }
public DateTime CreatedOn { get; set; }
public int TenantId { get; set; } = -1;
}
/// The bundle of currently-applicable, Published agreement versions a caller should
/// show a subject before letting them proceed — returned by
/// IAgreementConsentProvider.GetApplicableAgreementsAsync.
public class AgreementBundleDTO
{
public List Versions { get; set; } = new();
}