using GB5Shared.ListQuery;
namespace MMDAL.DTO.SupplyGroup
{
// ─────────────────────────────────────────────────────────────────────
// SupplyGroupListDTO – lean list result for supply group grid
//
// Auto-properties for list/grid display.
// TotalCount carries COUNT(*) OVER() from the window function.
// ─────────────────────────────────────────────────────────────────────
public sealed class SupplyGroupListDTO
{
public int SupplyGroupId { get; set; }
public string? SupplyGroupCode { get; set; }
public string? SupplyGroupName { get; set; }
public string? Remarks { get; set; }
public byte Status { get; set; }
public short SortOrder { get; set; }
public int TotalCount { get; set; } // COUNT(*) OVER()
}
// ─────────────────────────────────────────────────────────────────────
// Criteria — typed fields extracted from CriteriaDTO by CriteriaBinder
//
// [CriteriaField] maps CriteriaDTO FieldName values (case-insensitive).
// SearchText matches both legacy "headername" and generic "searchtext".
// ─────────────────────────────────────────────────────────────────────
///
/// Criteria for fetching supply group paged list.
///
public sealed class SupplyGroupListCriteria : ICriteria
{
[CriteriaField("headername", "searchtext")]
public string? SearchText { get; set; }
[CriteriaField("ouid")]
public int? OUId { get; set; }
[CriteriaField("pagesize")]
public int PageSize { get; set; } = 100;
[CriteriaField("pageoffset")]
public int PageOffset { get; set; } = 0;
}
// ─────────────────────────────────────────────────────────────────────
// Query record – dispatched through IListHandler (Pattern A, no router)
// ─────────────────────────────────────────────────────────────────────
public sealed record SupplyGroupListQuery(SupplyGroupListCriteria Criteria)
: IListQuery;
}