using DateTimeConverterCL;
namespace FrontOffice.Main.Utilities;
///
/// DTO for Commission Payout
///
public class CommissionPayoutDto
{
public long Id { get; set; }
public long WeekDefinitionId { get; set; }
public string WeekDisplayName { get; set; } = string.Empty;
public int BalancesEarned { get; set; }
public long TotalAmount { get; set; }
public string AmountFormatted { get; set; } = string.Empty;
public int Status { get; set; }
public string DatePersian { get; set; } = string.Empty;
// Computed properties for UI
public string StatusText => Status switch
{
0 => "در انتظار",
1 => "پرداخت شده",
2 => "درخواست برداشت",
3 => "برداشت شده",
4 => "شکست خورده",
5 => "لغو شده",
_ => "نامشخص"
};
public string StatusColor => Status switch
{
0 => "warning",
1 => "success",
2 => "info",
3 => "success",
4 => "error",
5 => "default",
_ => "default"
};
}
///
/// Response for paginated commission payouts
///
public class CommissionPayoutsResponseDto
{
public List Payouts { get; set; } = new();
public int TotalCount { get; set; }
public int PageNumber { get; set; }
public int PageSize { get; set; }
}
///
/// DTO for Weekly Balance details
///
public class WeeklyBalanceDto
{
public long WeekDefinitionId { get; set; }
public string WeekDisplayName { get; set; } = string.Empty;
public long LeftBalance { get; set; }
public long RightBalance { get; set; }
public long MinBalance { get; set; }
public int BalanceCount { get; set; }
public long CalculatedCommission { get; set; }
public int LeftCarryover { get; set; }
public int RightCarryover { get; set; }
public int LeftNewMembers { get; set; }
public int RightNewMembers { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
// Formatted properties
public string LeftBalanceFormatted => $"{LeftBalance:N0} ";
public string RightBalanceFormatted => $"{RightBalance:N0} ";
public string MinBalanceFormatted => $"{MinBalance:N0} ";
public string CalculatedCommissionFormatted => $"{CalculatedCommission:N0} ";
public string LeftCarryoverFormatted => $"{LeftCarryover:N0} ";
public string RightCarryoverFormatted => $"{RightCarryover:N0} ";
public string LeftNewMembersFormatted => $"{LeftNewMembers:N0}";
public string RightNewMembersFormatted => $"{RightNewMembers:N0}";
public string StartDatePersian => StartDate.MiladiToJalali();
public string EndDatePersian => EndDate.MiladiToJalali();
}
///
/// DTO for Week Definition (for dropdowns)
///
public class WeekDefinitionDto
{
public long Id { get; set; }
public int WeekOrder { get; set; }
public string DisplayName { get; set; } = string.Empty;
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public int GregorianYear { get; set; }
public int PersianYear { get; set; }
public bool IsActive { get; set; }
public bool IsCurrentWeek { get; set; }
public string StartDatePersian { get; set; } = string.Empty;
public string EndDatePersian { get; set; } = string.Empty;
// For display in dropdown
public string DropdownDisplay => IsCurrentWeek
? $"{DisplayName} (هفته جاری)"
: DisplayName;
public string DateRangeDisplay => $"{StartDate.MiladiToJalali()} - {EndDate.MiladiToJalali()}";
}