using System;
namespace GoodBooks.PAY.PAYDAL.DTO.Loyalty
{
///
/// Read-only projection of a customer's live loyalty balance.
/// Assembled by DAL from a JOIN across MCUSTLOYALTYENROLLMENT, MLOYALTYPROGRAM,
/// MLOYALTYTIER and an aggregate sub-query on TLOYALTYLEDGER.
/// Never persisted directly — use enrollment and ledger tables for writes.
///
public class LoyaltyBalanceDTO
{
#region PrivateMembers
private int enrollmentid;
private int customerid;
private int programid;
private string programname;
private string programcode;
private string tiername;
private decimal currentpoints;
private decimal lifetimepoints;
private string pointsname;
private decimal pointstocurrency;
private DateTime? lastactivitydate;
private decimal availablepoints;
private int tenantid;
#endregion
#region PublicProperties
public int EnrollmentId
{
get { return enrollmentid; }
set { enrollmentid = value; }
}
public int CustomerId
{
get { return customerid; }
set { customerid = value; }
}
public int ProgramId
{
get { return programid; }
set { programid = value; }
}
public string ProgramName
{
get { return programname; }
set { programname = value; }
}
public string ProgramCode
{
get { return programcode; }
set { programcode = value; }
}
public string TierName
{
get { return tiername; }
set { tiername = value; }
}
/// Stored current-points on the enrollment row (updated after each transaction).
public decimal CurrentPoints
{
get { return currentpoints; }
set { currentpoints = value; }
}
/// Cumulative earned points (never decremented) stored on the enrollment row.
public decimal LifetimePoints
{
get { return lifetimepoints; }
set { lifetimepoints = value; }
}
/// Display label for points (e.g. "Stars").
public string PointsName
{
get { return pointsname; }
set { pointsname = value; }
}
/// Currency value of 1 point (for display purposes).
public decimal PointsToCurrency
{
get { return pointstocurrency; }
set { pointstocurrency = value; }
}
public DateTime? LastActivityDate
{
get { return lastactivitydate; }
set { lastactivitydate = value; }
}
///
/// Live SUM from TLOYALTYLEDGER excluding expired points.
/// Computed via GET_AVAILABLE_POINTS sub-query — always accurate.
///
public decimal AvailablePoints
{
get { return availablepoints; }
set { availablepoints = value; }
}
public int TenantId
{
get { return tenantid; }
set { tenantid = value; }
}
#endregion
}
}