namespace foodmarket.Domain.Organizations;

/// <summary>Набор флагов разрешений роли. Хранится JSON-колонкой
/// (owned by EmployeeRole). Семантика: false = доступ запрещён.</summary>
public class RolePermissions
{
    // Каталог
    public bool ProductsView { get; set; }
    public bool ProductsEdit { get; set; }
    public bool ProductsDelete { get; set; }
    public bool ProductGroupsManage { get; set; }
    public bool PriceTypesManage { get; set; }
    public bool UnitsManage { get; set; }

    // Закупки
    public bool SuppliesView { get; set; }
    public bool SuppliesEdit { get; set; }
    public bool SuppliesPost { get; set; }
    public bool SuppliesDelete { get; set; }

    // Продажи (отгрузка контрагенту + POS)
    public bool DemandsView { get; set; }
    public bool DemandsEdit { get; set; }
    public bool DemandsPost { get; set; }
    public bool RetailSalesOperate { get; set; }
    public bool RetailSalesRefund { get; set; }

    // Контрагенты
    public bool CounterpartiesView { get; set; }
    public bool CounterpartiesEdit { get; set; }
    public bool CounterpartiesDelete { get; set; }

    // Склад / Остатки
    public bool StocksView { get; set; }
    public bool InventoryEdit { get; set; }
    public bool LossEdit { get; set; }
    public bool EnterEdit { get; set; }

    // Отчёты
    public bool ReportsView { get; set; }
    public bool ReportsFinanceView { get; set; }
    public bool ReportsStockView { get; set; }

    // Настройки организации
    public bool OrgSettingsManage { get; set; }
    public bool EmployeesManage { get; set; }
    public bool RolesManage { get; set; }
    public bool StoresManage { get; set; }
    public bool RetailPointsManage { get; set; }
    public bool CashRegistersManage { get; set; }
    public bool IntegrationsManage { get; set; }

    /// <summary>Полный набор всех true — для системной роли «Администратор».</summary>
    public static RolePermissions All() => new()
    {
        ProductsView = true, ProductsEdit = true, ProductsDelete = true,
        ProductGroupsManage = true, PriceTypesManage = true, UnitsManage = true,
        SuppliesView = true, SuppliesEdit = true, SuppliesPost = true, SuppliesDelete = true,
        DemandsView = true, DemandsEdit = true, DemandsPost = true,
        RetailSalesOperate = true, RetailSalesRefund = true,
        CounterpartiesView = true, CounterpartiesEdit = true, CounterpartiesDelete = true,
        StocksView = true, InventoryEdit = true, LossEdit = true, EnterEdit = true,
        ReportsView = true, ReportsFinanceView = true, ReportsStockView = true,
        OrgSettingsManage = true, EmployeesManage = true, RolesManage = true,
        StoresManage = true, RetailPointsManage = true,
        CashRegistersManage = true, IntegrationsManage = true,
    };
}
