#pragma once

#include <cstring>

#include "types.hpp"
#include "user.hpp"

enum task_period_t : uint8
{
  PERIOD_MORNING = 0x01,   // bit 0
  PERIOD_AFTERNOON = 0x02, // bit 1
  PERIOD_EVENING = 0x04,   // bit 2
  PERIOD_ALL_DAY = 0x07    // all bits
};

struct task_t
{
  char title[64];     // Task description
  int64 due_date;     // Unix timestamp (seconds) - used when recurrence is 0
  uint16 id;          // Auto-assigned (1–65535, 0 = empty slot)
  uint8 user_id;      // Owner (matches user_t.id)
  uint8 recurrence;   // Bitmask: bit0=Mon, bit1=Tue, ..., bit6=Sun. 0=none
  uint8 period : 3;   // Bitmask: bit0=Morning, bit1=Afternoon, bit2=Evening
  bool completed : 1; // Done flag
  bool active : 1;    // Slot in use
};

constexpr int MAX_TASKS = 32;
internal task_t g_Tasks[MAX_TASKS] = {};
internal uint16 g_NextTaskId = 1;
