#pragma once #include #include #include #include #include #include "Database.h" #include "Status.h" // How taken an account is, judged by its tasks: // Free - only Done, Frozen or Uploading tasks, or no tasks // Taken - has a Prompt task (and nothing Busy) // Busy - has a Testing, Limit reset or Wait task, or a wait nothing else shows enum class AccountLevel { Busy, Taken, Free }; std::string accountLevelName(AccountLevel level); // "busy", "taken", "free" enum class WaitState { None, Waiting, LimitReset }; // A task as the user sees it: the status is computed from the stored status, // the account's wait and the current time. struct TaskInfo { std::string name; std::optional account; Status status; // as shown (Wait / Limit reset come from the account) Status storedStatus; // what is saved underneath std::string notes; std::size_t noteLines = 0; }; struct AccountInfo { std::string name; AccountLevel level = AccountLevel::Free; WaitState waitState = WaitState::None; std::time_t waitUntil = 0; // when the wait ends (or ended); 0 if none // True when the account has a wait that none of its tasks shows (it has no // tasks, or only Done / Frozen / Uploading ones). It still makes the account Busy. bool waitListed = false; std::vector tasks; // tasks at the account's level (Free: its Uploading/Frozen/Done ones) }; // Tasks in display order: status priority (Limit reset, Testing, Prompt, Wait, // Uploading, Frozen, Done); for Wait and Limit reset then time, earliest first; // then account A-Z (none last); then task name. std::vector buildTasks(const Database& db, std::time_t now); // Accounts in display order, most free first: Free, Taken, Busy; within Taken // and Busy fewer entries first; ties by name. std::vector buildAccounts(const Database& db, std::time_t now);