import 'package:flutter/cupertino.dart';
import 'package:mobile_pos/currency.dart';
import 'package:mobile_pos/generated/l10n.dart' as lang;

class GridItems {
  final String title, icon, route;
  final Color iconColor;

  GridItems(
      {required this.route, required this.title, required this.icon, required this.iconColor});
}

List<GridItems> getFreeIcons({required BuildContext context}) {
  List<GridItems> freeIcons = [
    if ((isSubUser && finalUserRoleModel.posSaleCreate == true) || !isSubUser)
      GridItems(
        title: lang.S.of(context).sales,
        route: 'Sales',
        icon: 'images/sales.svg',
        iconColor: Color(0xffEBD7FF),
      ),
    if ((isSubUser &&
            (finalUserRoleModel.customerListRead == true ||
                finalUserRoleModel.supplierListRead == true)) ||
        !isSubUser)
      GridItems(
        title: lang.S.of(context).parties,
        icon: 'images/parties.svg',
        route: 'Parties',
        iconColor: const Color(0xffFFD6E2),
      ),
    if ((isSubUser && finalUserRoleModel.purchaseCreate == true) || !isSubUser)
      GridItems(
        title: lang.S.of(context).purchase,
        icon: 'images/purchase.svg',
        route: 'Purchase',
        iconColor: const Color(0xffBBFFC1),
      ),
    if ((isSubUser && finalUserRoleModel.productRead == true) || !isSubUser)
      GridItems(
        title: lang.S.of(context).product,
        icon: 'images/product.svg',
        route: 'Product',
        iconColor: const Color(0xffD9EEFF),
      ),
    if ((isSubUser && finalUserRoleModel.quotationListRead == true) || !isSubUser)
      GridItems(
        title: "Quotation",
        icon: 'images/quotation.svg',
        route: "quotation",
        iconColor: const Color(0xffd9f7f5),
      ),
    if ((isSubUser && finalUserRoleModel.dueListRead == true) || !isSubUser)
      GridItems(
        title: lang.S.of(context).dueList,
        icon: 'images/duelist.svg',
        route: 'Due List',
        iconColor: const Color(0xffFFE4C1),
      ),
    if ((isSubUser && finalUserRoleModel.stockListRead == true) || !isSubUser)
      GridItems(
        title: lang.S.of(context).stocks,
        icon: 'images/stock.svg',
        route: 'Stock List',
        iconColor: const Color(0xffBFFFEF),
      ),
    if ((isSubUser && finalUserRoleModel.allReportsRead == true) || !isSubUser)
      GridItems(
        title: lang.S.of(context).reports,
        icon: 'images/report.svg',
        route: 'Reports',
        iconColor: const Color(0xffFFD6E2),
      ),
    if ((isSubUser && finalUserRoleModel.saleListRead == true) || !isSubUser)
      GridItems(
        title: lang.S.of(context).salesList,
        icon: 'images/saleslist.svg',
        route: 'Sale List',
        iconColor: const Color(0xffEDDBFF),
      ),
    if ((isSubUser && finalUserRoleModel.purchaseRead == true) || !isSubUser)
      GridItems(
        title: lang.S.of(context).purchaseList,
        icon: 'images/purchaselist.svg',
        route: 'Purchase List',
        iconColor: const Color(0xffF7CCFE),
      ),
    if ((isSubUser && finalUserRoleModel.lossProfitRead == true) || !isSubUser)
      GridItems(
        title: lang.S.of(context).lossOrProfit,
        icon: 'images/loss.svg',
        route: 'Loss/Profit',
        iconColor: const Color(0xffBBFFC1),
      ),
    if ((isSubUser && finalUserRoleModel.ledgerRead == true) || !isSubUser)
      GridItems(
        title: lang.S.of(context).ledger,
        icon: 'images/ledger.svg',
        route: 'Ledger',
        iconColor: const Color(0xffD4ECFF),
      ),
    if ((isSubUser && finalUserRoleModel.expenseRead == true) || !isSubUser)
      GridItems(
        title: lang.S.of(context).expense,
        icon: 'images/expense.svg',
        route: 'Expense',
        iconColor: const Color(0xffFFE4C1),
      ),
    if ((isSubUser && finalUserRoleModel.incomeRead == true) || !isSubUser)
      GridItems(
        title: 'Income',
        icon: 'images/income.svg',
        route: 'income',
        iconColor: const Color(0xffE7F5FF),
      ),
    if ((isSubUser && finalUserRoleModel.taxRateRead == true) || !isSubUser)
      GridItems(
        title: lang.S.of(context).taxReport,
        icon: 'images/saleslist.svg',
        route: 'taxReport',
        iconColor: const Color(0xffEBD7FF),
      ),
    if ((isSubUser && finalUserRoleModel.hrmRead == true) || !isSubUser)
      GridItems(
        title: "HRM",
        icon: 'images/duelist.svg',
        route: 'hrm',
        iconColor: const Color(0xffFFF6ED),
      ),
    GridItems(
      title: "Custom Print",
      icon: 'images/printer.svg',
      route: 'customPrint',
      iconColor: const Color(0xffD6EFF4),
    ),
    // GridItems(
    //   title: 'SMS',
    //   icon: 'images/sms.png',
    // ),
    // GridItems(
    //   title: 'Warranty',
    //   icon: 'images/warranty.png',
    // ),
    // GridItems(
    //   title: 'Delivery',
    //   icon: 'images/delivery.png',
    // ),
    // GridItems(
    //   title: 'Calculator',
    //   icon: 'images/calculator.png',
    // ),
    // GridItems(
    //   title: 'Expense',
    //   icon: 'images/expenses.png',
    // )
  ];
  return freeIcons;
}
