namespace Meezi.Core.Authorization;

/// <summary>
/// Capabilities a café employee can be granted. These are the single source of
/// truth for authorization — controllers check a <see cref="Permission"/> rather
/// than hard-coding role names, so the role→capability mapping lives in exactly
/// one place (<see cref="RolePermissions"/>).
///
/// Granularity is "full CRUD per module + distinct sensitive actions": each page
/// has a View capability, record modules split Create/Edit/Delete, and high-risk
/// operations (void, refund, discount, comp, cash drawer, export) are their own
/// permissions so an owner can grant day-to-day work without the dangerous bits.
///
/// Names are persisted (custom roles store them by name in JSON, and they ride in
/// the JWT). Renaming or removing a value is a breaking change — add, don't rename.
/// </summary>
public enum Permission
{
    // ── Café administration (owner tier) ──────────────────────────────────────
    ViewCafeSettings,
    ManageCafeSettings,
    ManageDiscoverProfile,
    ViewBilling,
    ManageBilling,
    ViewBranches,
    CreateBranch,
    EditBranch,
    DeleteBranch,
    ManageRoles,
    ViewPrintSettings,
    ManagePrintSettings,

    // ── Taxes ─────────────────────────────────────────────────────────────────
    ViewTaxes,
    CreateTax,
    EditTax,
    DeleteTax,

    // ── Staff & HR ──────────────────────────────────────────────────────────────
    ViewStaff,
    CreateStaff,
    EditStaff,
    DeleteStaff,
    /// <summary>Assign per-branch roles / org structure (distinct from editing a record).</summary>
    ManageStaff,
    ManageStaffCredentials,
    ViewAttendance,
    ManageAttendance,
    ViewSchedules,
    ManageSchedules,
    ViewLeave,
    ReviewLeave,
    ViewSalaries,
    ManageSalaries,

    // ── Menu ──────────────────────────────────────────────────────────────────
    ViewMenu,
    CreateMenuItem,
    EditMenuItem,
    DeleteMenuItem,

    // ── Inventory ───────────────────────────────────────────────────────────────
    ViewInventory,
    CreateInventory,
    EditInventory,
    DeleteInventory,

    // ── Tables ──────────────────────────────────────────────────────────────────
    ViewTables,
    ManageTables,

    // ── Reservations ──────────────────────────────────────────────────────────
    ViewReservations,
    CreateReservation,
    EditReservation,
    DeleteReservation,

    // ── Orders & POS ──────────────────────────────────────────────────────────
    ViewOrders,
    ProcessOrders,
    EditOrder,
    VoidOrder,
    RefundOrder,
    ApplyDiscount,
    CompOrder,
    HandlePayments,
    UpdateOrderStatus,

    // ── Register / cash ──────────────────────────────────────────────────────
    OperateRegister,
    OpenCashDrawer,

    // ── Queue ─────────────────────────────────────────────────────────────────
    ViewQueue,
    ManageQueue,

    // ── Kitchen ───────────────────────────────────────────────────────────────
    ViewKitchen,
    ManageKitchenStations,

    // ── Delivery ──────────────────────────────────────────────────────────────
    ViewDelivery,
    HandleDelivery,
    AssignDelivery,

    // ── Customers / CRM ───────────────────────────────────────────────────────
    ViewCustomers,
    CreateCustomer,
    EditCustomer,
    DeleteCustomer,

    // ── Coupons ───────────────────────────────────────────────────────────────
    ViewCoupons,
    CreateCoupon,
    EditCoupon,
    DeleteCoupon,

    // ── SMS / marketing ──────────────────────────────────────────────────────
    ViewSms,
    SendSms,
    ManageSmsSettings,

    // ── Reviews ───────────────────────────────────────────────────────────────
    ViewReviews,
    ManageReviews,

    // ── Reports & finance ─────────────────────────────────────────────────────
    ViewReports,
    ExportReports,
    ViewAuditLog,
    ViewFinancials,
    ManageFinancials,

    // ── Expenses ──────────────────────────────────────────────────────────────
    ViewExpenses,
    CreateExpense,
    EditExpense,
    DeleteExpense,
}
