class UserRoleModel {
  String? id;
  String? databaseId;
  String? userEmail;

  //-----------add new permission in model---------------------
  bool? dashboardRead;
  bool? posSaleRead;
  bool? posSaleCreate;
  bool? posSaleDelete;
  bool? posSaleUpdate;
  bool? inventorySaleRead;
  bool? inventorySaleCreate;
  bool? inventorySaleUpdate;
  bool? inventorySaleDelete;
  bool? saleListRead;
  bool? saleListCreate;
  bool? saleListUpdate;
  bool? saleListDelete;
  bool? saleReturnRead;
  bool? saleReturnCreate;
  bool? saleReturnUpdate;
  bool? saleReturnDelete;
  bool? quotationListRead;
  bool? quotationListCreate;
  bool? quotationListUpdate;
  bool? quotationListDelete;
  bool? purchaseRead;
  bool? purchaseCreate;
  bool? purchaseUpdate;
  bool? purchaseDelete;
  bool? purchaseReturnRead;
  bool? purchaseReturnCreate;
  bool? purchaseReturnUpdate;
  bool? purchaseReturnDelete;
  bool? productRead;
  bool? productCreate;
  bool? productUpdate;
  bool? productDelete;
  bool? lowStockRead;
  bool? lowStockCreate;
  bool? lowStockUpdate;
  bool? lowStockDelete;
  bool? expiredRead;
  bool? expiredCreate;
  bool? expiredUpdate;
  bool? expiredDelete;
  bool? categoriesRead;
  bool? categoriesCreate;
  bool? categoriesUpdate;
  bool? categoriesDelete;
  bool? brandRead;
  bool? brandCreate;
  bool? brandUpdate;
  bool? brandDelete;
  bool? unitRead;
  bool? unitCreate;
  bool? unitUpdate;
  bool? unitDelete;
  bool? wareHouseRead;
  bool? wareHouseCreate;
  bool? wareHouseUpdate;
  bool? wareHouseDelete;
  bool? supplierListRead;
  bool? supplierListCreate;
  bool? supplierListUpdate;
  bool? supplierListDelete;
  bool? customerListRead;
  bool? customerListCreate;
  bool? customerListUpdate;
  bool? customerListDelete;
  bool? dueListRead;
  bool? dueListCreate;
  bool? dueListUpdate;
  bool? dueListDelete;
  bool? ledgerRead;
  bool? ledgerCreate;
  bool? ledgerUpdate;
  bool? ledgerDelete;
  bool? lossProfitRead;
  bool? lossProfitCreate;
  bool? lossProfitUpdate;
  bool? lossProfitDelete;
  bool? paymentTypeRead;
  bool? paymentTypeCreate;
  bool? paymentTypeUpdate;
  bool? paymentTypeDelete;
  bool? expenseRead;
  bool? expenseCreate;
  bool? expenseUpdate;
  bool? expenseDelete;
  bool? expenseCategoryRead;
  bool? expenseCategoryCreate;
  bool? expenseCategoryUpdate;
  bool? expenseCategoryDelete;
  bool? incomeRead;
  bool? incomeCreate;
  bool? incomeUpdate;
  bool? incomeDelete;
  bool? incomeCategoryRead;
  bool? incomeCategoryCreate;
  bool? incomeCategoryUpdate;
  bool? incomeCategoryDelete;
  bool? transactionRead;
  bool? transactionCreate;
  bool? transactionUpdate;
  bool? transactionDelete;
  bool? allReportsRead;
  bool? allReportsCreate;
  bool? allReportsUpdate;
  bool? allReportsDelete;
  bool? whatsAppMarketingRead;
  bool? whatsAppMarketingCreate;
  bool? whatsAppMarketingUpdate;
  bool? whatsAppMarketingDelete;
  bool? stockListRead;
  bool? stockListCreate;
  bool? stockListUpdate;
  bool? stockListDelete;
  bool? subscriptionRead;
  bool? subscriptionCreate;
  bool? subscriptionUpdate;
  bool? subscriptionDelete;
  bool? userRoleRead;
  bool? userRoleCreate;
  bool? userRoleUpdate;
  bool? userRoleDelete;
  bool? taxRateRead;
  bool? taxRateCreate;
  bool? taxRateUpdate;
  bool? taxRateDelete;
  bool? hrmRead;
  bool? hrmCreate;
  bool? hrmUpdate;
  bool? hrmDelete;

  UserRoleModel({
    this.id,
    this.databaseId,
    this.userEmail,
    //-----------add new permission in model---------------------
    this.dashboardRead,
    this.posSaleRead,
    this.posSaleCreate,
    this.posSaleDelete,
    this.posSaleUpdate,
    this.inventorySaleRead,
    this.inventorySaleCreate,
    this.inventorySaleUpdate,
    this.inventorySaleDelete,
    this.saleListRead,
    this.saleListCreate,
    this.saleListUpdate,
    this.saleListDelete,
    this.saleReturnRead,
    this.saleReturnCreate,
    this.saleReturnUpdate,
    this.saleReturnDelete,
    this.quotationListRead,
    this.quotationListCreate,
    this.quotationListUpdate,
    this.quotationListDelete,
    this.purchaseRead,
    this.purchaseCreate,
    this.purchaseUpdate,
    this.purchaseDelete,
    this.purchaseReturnRead,
    this.purchaseReturnCreate,
    this.purchaseReturnUpdate,
    this.purchaseReturnDelete,
    this.productRead,
    this.productCreate,
    this.productUpdate,
    this.productDelete,
    this.lowStockRead,
    this.lowStockCreate,
    this.lowStockUpdate,
    this.lowStockDelete,
    this.expiredRead,
    this.expiredCreate,
    this.expiredUpdate,
    this.expiredDelete,
    this.categoriesRead,
    this.categoriesCreate,
    this.categoriesUpdate,
    this.categoriesDelete,
    this.brandRead,
    this.brandCreate,
    this.brandUpdate,
    this.brandDelete,
    this.unitRead,
    this.unitCreate,
    this.unitUpdate,
    this.unitDelete,
    this.wareHouseRead,
    this.wareHouseCreate,
    this.wareHouseUpdate,
    this.wareHouseDelete,
    this.supplierListRead,
    this.supplierListCreate,
    this.supplierListUpdate,
    this.supplierListDelete,
    this.customerListRead,
    this.customerListCreate,
    this.customerListUpdate,
    this.customerListDelete,
    this.dueListRead,
    this.dueListCreate,
    this.dueListUpdate,
    this.dueListDelete,
    this.ledgerRead,
    this.ledgerCreate,
    this.ledgerUpdate,
    this.ledgerDelete,
    this.lossProfitRead,
    this.lossProfitCreate,
    this.lossProfitUpdate,
    this.lossProfitDelete,
    this.paymentTypeRead,
    this.paymentTypeCreate,
    this.paymentTypeUpdate,
    this.paymentTypeDelete,
    this.expenseRead,
    this.expenseCreate,
    this.expenseUpdate,
    this.expenseDelete,
    this.expenseCategoryRead,
    this.expenseCategoryCreate,
    this.expenseCategoryUpdate,
    this.expenseCategoryDelete,
    this.incomeRead,
    this.incomeCreate,
    this.incomeUpdate,
    this.incomeDelete,
    this.incomeCategoryRead,
    this.incomeCategoryCreate,
    this.incomeCategoryUpdate,
    this.incomeCategoryDelete,
    this.transactionRead,
    this.transactionCreate,
    this.transactionUpdate,
    this.transactionDelete,
    this.allReportsRead,
    this.allReportsCreate,
    this.allReportsUpdate,
    this.allReportsDelete,
    this.whatsAppMarketingRead,
    this.whatsAppMarketingCreate,
    this.whatsAppMarketingUpdate,
    this.whatsAppMarketingDelete,
    this.stockListRead,
    this.stockListCreate,
    this.stockListUpdate,
    this.stockListDelete,
    this.subscriptionRead,
    this.subscriptionCreate,
    this.subscriptionUpdate,
    this.subscriptionDelete,
    this.userRoleRead,
    this.userRoleCreate,
    this.userRoleUpdate,
    this.userRoleDelete,
    this.taxRateRead,
    this.taxRateCreate,
    this.taxRateUpdate,
    this.taxRateDelete,
    this.hrmRead,
    this.hrmCreate,
    this.hrmUpdate,
    this.hrmDelete,
  });

  factory UserRoleModel.fromJson(Map<String, dynamic> json) => UserRoleModel(
        id: json["id"] ?? '',
        databaseId: json["databaseId"] ?? '',
        userEmail: json["userEmail"] ?? '',
        //-----------add new permission in model---------------------
        dashboardRead: json["dashboardRead"] ?? false,
        posSaleRead: json["posSaleRead"] ?? false,
        posSaleCreate: json["posSaleCreate"] ?? false,
        posSaleDelete: json["posSaleDelete"] ?? false,
        posSaleUpdate: json["posSaleUpdate"] ?? false,
        inventorySaleRead: json["inventorySaleRead"] ?? false,
        inventorySaleCreate: json["inventorySaleCreate"] ?? false,
        inventorySaleUpdate: json["inventorySaleUpdate"] ?? false,
        inventorySaleDelete: json["inventorySaleDelete"] ?? false,
        saleListRead: json["saleListRead"] ?? false,
        saleListCreate: json["saleListCreate"] ?? false,
        saleListUpdate: json["saleListUpdate"] ?? false,
        saleListDelete: json["saleListDelete"] ?? false,
        saleReturnRead: json["saleReturnRead"] ?? false,
        saleReturnCreate: json["saleReturnCreate"] ?? false,
        saleReturnUpdate: json["saleReturnUpdate"] ?? false,
        saleReturnDelete: json["saleReturnDelete"] ?? false,
        quotationListRead: json["quotationListRead"] ?? false,
        quotationListCreate: json["quotationListCreate"] ?? false,
        quotationListUpdate: json["quotationListUpdate"] ?? false,
        quotationListDelete: json["quotationListDelete"] ?? false,
        purchaseRead: json["purchaseRead"] ?? false,
        purchaseCreate: json["purchaseCreate"] ?? false,
        purchaseUpdate: json["purchaseUpdate"] ?? false,
        purchaseDelete: json["purchaseDelete"] ?? false,
        purchaseReturnRead: json["purchaseReturnRead"] ?? false,
        purchaseReturnCreate: json["purchaseReturnCreate"] ?? false,
        purchaseReturnUpdate: json["purchaseReturnUpdate"] ?? false,
        purchaseReturnDelete: json["purchaseReturnDelete"] ?? false,
        productRead: json["productRead"] ?? false,
        productCreate: json["productCreate"] ?? false,
        productUpdate: json["productUpdate"] ?? false,
        productDelete: json["productDelete"] ?? false,
        lowStockRead: json["lowStockRead"] ?? false,
        lowStockCreate: json["lowStockCreate"] ?? false,
        lowStockUpdate: json["lowStockUpdate"] ?? false,
        lowStockDelete: json["lowStockDelete"] ?? false,
        expiredRead: json["expiredRead"] ?? false,
        expiredCreate: json["expiredCreate"] ?? false,
        expiredUpdate: json["expiredUpdate"] ?? false,
        expiredDelete: json["expiredDelete"] ?? false,
        categoriesRead: json["categoriesRead"] ?? false,
        categoriesCreate: json["categoriesCreate"] ?? false,
        categoriesUpdate: json["categoriesUpdate"] ?? false,
        categoriesDelete: json["categoriesDelete"] ?? false,
        brandRead: json["brandRead"] ?? false,
        brandCreate: json["brandCreate"] ?? false,
        brandUpdate: json["brandUpdate"] ?? false,
        brandDelete: json["brandDelete"] ?? false,
        unitRead: json["unitRead"] ?? false,
        unitCreate: json["unitCreate"] ?? false,
        unitUpdate: json["unitUpdate"] ?? false,
        unitDelete: json["unitDelete"] ?? false,
        wareHouseRead: json["wareHouseRead"] ?? false,
        wareHouseCreate: json["wareHouseCreate"] ?? false,
        wareHouseUpdate: json["wareHouseUpdate"] ?? false,
        wareHouseDelete: json["wareHouseDelete"] ?? false,
        supplierListRead: json["supplierListRead"] ?? false,
        supplierListCreate: json["supplierListCreate"] ?? false,
        supplierListUpdate: json["supplierListUpdate"] ?? false,
        supplierListDelete: json["supplierListDelete"] ?? false,
        customerListRead: json["customerListRead"] ?? false,
        customerListCreate: json["customerListCreate"] ?? false,
        customerListUpdate: json["customerListUpdate"] ?? false,
        customerListDelete: json["customerListDelete"] ?? false,
        ledgerRead: json["ledgerRead"] ?? false,
        ledgerCreate: json["ledgerCreate"] ?? false,
        ledgerUpdate: json["ledgerUpdate"] ?? false,
        ledgerDelete: json["ledgerDelete"] ?? false,
        lossProfitRead: json["lossProfitRead"] ?? false,
        lossProfitCreate: json["lossProfitCreate"] ?? false,
        lossProfitUpdate: json["lossProfitUpdate"] ?? false,
        lossProfitDelete: json["lossProfitDelete"] ?? false,
        paymentTypeRead: json["paymentTypeRead"] ?? false,
        paymentTypeCreate: json["paymentTypeCreate"] ?? false,
        paymentTypeUpdate: json["paymentTypeUpdate"] ?? false,
        paymentTypeDelete: json["paymentTypeDelete"] ?? false,
        expenseRead: json["expenseRead"] ?? false,
        expenseCreate: json["expenseCreate"] ?? false,
        expenseUpdate: json["expenseUpdate"] ?? false,
        expenseDelete: json["expenseDelete"] ?? false,
        expenseCategoryRead: json["expenseCategoryRead"] ?? false,
        expenseCategoryCreate: json["expenseCategoryCreate"] ?? false,
        expenseCategoryUpdate: json["expenseCategoryUpdate"] ?? false,
        expenseCategoryDelete: json["expenseCategoryDelete"] ?? false,
        incomeRead: json["incomeRead"] ?? false,
        incomeCreate: json["incomeCreate"] ?? false,
        incomeUpdate: json["incomeUpdate"] ?? false,
        incomeDelete: json["incomeDelete"] ?? false,
        incomeCategoryRead: json["incomeCategoryRead"] ?? false,
        incomeCategoryCreate: json["incomeCategoryCreate"] ?? false,
        incomeCategoryUpdate: json["incomeCategoryUpdate"] ?? false,
        incomeCategoryDelete: json["incomeCategoryDelete"] ?? false,
        transactionRead: json["transactionRead"] ?? false,
        transactionCreate: json["transactionCreate"] ?? false,
        transactionUpdate: json["transactionUpdate"] ?? false,
        transactionDelete: json["transactionDelete"] ?? false,
        allReportsRead: json["allReportsRead"] ?? false,
        allReportsCreate: json["allReportsCreate"] ?? false,
        allReportsUpdate: json["allReportsUpdate"] ?? false,
        allReportsDelete: json["allReportsDelete"] ?? false,
        whatsAppMarketingRead: json["whatsAppMarketingRead"] ?? false,
        whatsAppMarketingCreate: json["whatsAppMarketingCreate"] ?? false,
        whatsAppMarketingUpdate: json["whatsAppMarketingUpdate"] ?? false,
        whatsAppMarketingDelete: json["whatsAppMarketingDelete"] ?? false,
        stockListRead: json["stockListRead"] ?? false,
        stockListCreate: json["stockListCreate"] ?? false,
        stockListUpdate: json["stockListUpdate"] ?? false,
        stockListDelete: json["stockListDelete"] ?? false,
        subscriptionRead: json["subscriptionRead"] ?? false,
        subscriptionCreate: json["subscriptionCreate"] ?? false,
        subscriptionUpdate: json["subscriptionUpdate"] ?? false,
        subscriptionDelete: json["subscriptionDelete"] ?? false,
        userRoleRead: json["userRoleRead"] ?? false,
        userRoleCreate: json["userRoleCreate"] ?? false,
        userRoleUpdate: json["userRoleUpdate"] ?? false,
        userRoleDelete: json["userRoleDelete"] ?? false,
        taxRateRead: json["taxRateRead"] ?? false,
        taxRateCreate: json["taxRateCreate"] ?? false,
        taxRateUpdate: json["taxRateUpdate"] ?? false,
        taxRateDelete: json["taxRateDelete"] ?? false,
        hrmRead: json["hrmRead"] ?? false,
        hrmCreate: json["hrmCreate"] ?? false,
        hrmUpdate: json["hrmUpdate"] ?? false,
        hrmDelete: json["hrmDelete"] ?? false,
        dueListRead: json["dueListRead"] ?? false,
        dueListCreate: json["dueListCreate"] ?? false,
        dueListUpdate: json["dueListUpdate"] ?? false,
        dueListDelete: json["dueListDelete"] ?? false,
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "databaseId": databaseId,
        "userEmail": userEmail,
        //-----------add new permission in model---------------------
        "dashboardRead": dashboardRead,
        "posSaleRead": posSaleRead,
        "posSaleCreate": posSaleCreate,
        "posSaleDelete": posSaleDelete,
        "posSaleUpdate": posSaleUpdate,
        "inventorySaleRead": inventorySaleRead,
        "inventorySaleCreate": inventorySaleCreate,
        "inventorySaleUpdate": inventorySaleUpdate,
        "inventorySaleDelete": inventorySaleDelete,
        "saleListRead": saleListRead,
        "saleListCreate": saleListCreate,
        "saleListUpdate": saleListUpdate,
        "saleListDelete": saleListDelete,
        "saleReturnRead": saleReturnRead,
        "saleReturnCreate": saleReturnCreate,
        "saleReturnUpdate": saleReturnUpdate,
        "saleReturnDelete": saleReturnDelete,
        "quotationListRead": quotationListRead,
        "quotationListCreate": quotationListCreate,
        "quotationListUpdate": quotationListUpdate,
        "quotationListDelete": quotationListDelete,
        "purchaseRead": purchaseRead,
        "purchaseCreate": purchaseCreate,
        "purchaseUpdate": purchaseUpdate,
        "purchaseDelete": purchaseDelete,
        "purchaseReturnRead": purchaseReturnRead,
        "purchaseReturnCreate": purchaseReturnCreate,
        "purchaseReturnUpdate": purchaseReturnUpdate,
        "purchaseReturnDelete": purchaseReturnDelete,
        "productRead": productRead,
        "productCreate": productCreate,
        "productUpdate": productUpdate,
        "productDelete": productDelete,
        "lowStockRead": lowStockRead,
        "lowStockCreate": lowStockCreate,
        "lowStockUpdate": lowStockUpdate,
        "lowStockDelete": lowStockDelete,
        "expiredRead": expiredRead,
        "expiredCreate": expiredCreate,
        "expiredUpdate": expiredUpdate,
        "expiredDelete": expiredDelete,
        "categoriesRead": categoriesRead,
        "categoriesCreate": categoriesCreate,
        "categoriesUpdate": categoriesUpdate,
        "categoriesDelete": categoriesDelete,
        "brandRead": brandRead,
        "brandCreate": brandCreate,
        "brandUpdate": brandUpdate,
        "brandDelete": brandDelete,
        "unitRead": unitRead,
        "unitCreate": unitCreate,
        "unitUpdate": unitUpdate,
        "unitDelete": unitDelete,
        "wareHouseRead": wareHouseRead,
        "wareHouseCreate": wareHouseCreate,
        "wareHouseUpdate": wareHouseUpdate,
        "wareHouseDelete": wareHouseDelete,
        "supplierListRead": supplierListRead,
        "supplierListCreate": supplierListCreate,
        "supplierListUpdate": supplierListUpdate,
        "supplierListDelete": supplierListDelete,
        "customerListRead": customerListRead,
        "customerListCreate": customerListCreate,
        "customerListUpdate": customerListUpdate,
        "customerListDelete": customerListDelete,
        "ledgerRead": ledgerRead,
        "ledgerCreate": ledgerCreate,
        "ledgerUpdate": ledgerUpdate,
        "ledgerDelete": ledgerDelete,
        "lossProfitRead": lossProfitRead,
        "lossProfitCreate": lossProfitCreate,
        "lossProfitUpdate": lossProfitUpdate,
        "lossProfitDelete": lossProfitDelete,
        "paymentTypeRead": paymentTypeRead,
        "paymentTypeCreate": paymentTypeCreate,
        "paymentTypeUpdate": paymentTypeUpdate,
        "paymentTypeDelete": paymentTypeDelete,
        "expenseRead": expenseRead,
        "expenseCreate": expenseCreate,
        "expenseUpdate": expenseUpdate,
        "expenseDelete": expenseDelete,
        "expenseCategoryRead": expenseCategoryRead,
        "expenseCategoryCreate": expenseCategoryCreate,
        "expenseCategoryUpdate": expenseCategoryUpdate,
        "expenseCategoryDelete": expenseCategoryDelete,
        "incomeRead": incomeRead,
        "incomeCreate": incomeCreate,
        "incomeUpdate": incomeUpdate,
        "incomeDelete": incomeDelete,
        "incomeCategoryRead": incomeCategoryRead,
        "incomeCategoryCreate": incomeCategoryCreate,
        "incomeCategoryUpdate": incomeCategoryUpdate,
        "incomeCategoryDelete": incomeCategoryDelete,
        "transactionRead": transactionRead,
        "transactionCreate": transactionCreate,
        "transactionUpdate": transactionUpdate,
        "transactionDelete": transactionDelete,
        "allReportsRead": allReportsRead,
        "allReportsCreate": allReportsCreate,
        "allReportsUpdate": allReportsUpdate,
        "allReportsDelete": allReportsDelete,
        "whatsAppMarketingRead": whatsAppMarketingRead,
        "whatsAppMarketingCreate": whatsAppMarketingCreate,
        "whatsAppMarketingUpdate": whatsAppMarketingUpdate,
        "whatsAppMarketingDelete": whatsAppMarketingDelete,
        "stockListRead": stockListRead,
        "stockListCreate": stockListCreate,
        "stockListUpdate": stockListUpdate,
        "stockListDelete": stockListDelete,
        "subscriptionRead": subscriptionRead,
        "subscriptionCreate": subscriptionCreate,
        "subscriptionUpdate": subscriptionUpdate,
        "subscriptionDelete": subscriptionDelete,
        "userRoleRead": userRoleRead,
        "userRoleCreate": userRoleCreate,
        "userRoleUpdate": userRoleUpdate,
        "userRoleDelete": userRoleDelete,
        "taxRateRead": taxRateRead,
        "taxRateCreate": taxRateCreate,
        "taxRateUpdate": taxRateUpdate,
        "taxRateDelete": taxRateDelete,
        "hrmRead": hrmRead,
        "hrmCreate": hrmCreate,
        "hrmUpdate": hrmUpdate,
        "hrmDelete": hrmDelete,
        "dueListRead": dueListRead,
        "dueListCreate": dueListCreate,
        "dueListUpdate": dueListUpdate,
        "dueListDelete": dueListDelete,
      };
}

class Permission {
  String title;
  bool read;
  bool update;
  bool delete;
  bool create;

  Permission({required this.title, this.update = false, this.delete = false, this.create = false, this.read = false});
}

class UserPermissionModel {
  String? id;
  String? roleId;
  String? databaseId;
  String? userEmail;

  UserPermissionModel({
    this.id,
    this.roleId,
    this.databaseId,
    this.userEmail,
  });

  factory UserPermissionModel.fromJson(Map<String, dynamic> json) => UserPermissionModel(
        id: json["id"] ?? '',
        roleId: json["roleId"] ?? '',
        databaseId: json["databaseId"] ?? '',
        userEmail: json["userEmail"] ?? '',
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "roleId": roleId,
        "databaseId": databaseId,
        "userEmail": userEmail,
      };
}
