using System.Threading; using System.Threading.Tasks; using UtopiaCanteenSystem.Models; namespace UtopiaCanteenSystem.Services; /// /// Handles RFID scan logic: validation, timeout rules, and persisting scan records. /// public interface IRfidService { /// /// Processes a scan for the given card ID. Applies configured timeout, /// saves to lunch_order_transactions if allowed, and returns result message. /// (bool Success, string Message) ProcessScan(string cardId); /// /// Processes a scan and also returns cooldown seconds remaining when blocked by timeout rules. /// ScanResult ProcessScanDetailed(string cardId); /// Returns the last scan record for display (e.g. dashboard). ScanRecord? GetLastScan(); /// Returns the most recent scan records, newest first (for order history). IReadOnlyList GetLastScans(int count); /// Returns all scan records for today (local date), newest first. IReadOnlyList GetScansForToday(); /// Returns the count of scans recorded today (local date). int GetTodayScanCount(); /// /// Returns the count of scans recorded today (local date boundaries), asynchronously. /// Task GetTodayScanCountAsync(CancellationToken cancellationToken = default); /// Returns total number of scans/orders recorded (all time). Task GetTotalScanCountAsync(CancellationToken cancellationToken = default); /// /// Returns total number of scans recorded for a given card ID (all time). /// Used to detect repeat scans by the same user. /// Task GetTotalScanCountForCardAsync(string cardId, CancellationToken cancellationToken = default); /// /// Returns number of scans recorded today (local day) for a given card ID. /// Task GetTodayScanCountForCardAsync(string cardId, CancellationToken cancellationToken = default); }