Line data Source code
1 : // Copyright 2024 The terCAD team. All rights reserved.
2 : // Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file.
3 :
4 : import 'package:app_finance/_classes/herald/app_locale.dart';
5 : import 'package:app_finance/design/form/list_selector_item.dart';
6 :
7 : enum AppAutomationType { week, month, year, days }
8 :
9 : class AutomationType {
10 0 : static List<ListSelectorItem> getList() {
11 0 : return [
12 0 : ListSelectorItem(id: AppAutomationType.week.name, name: AppLocale.labels.budgetTypeWeek),
13 0 : ListSelectorItem(id: AppAutomationType.month.name, name: AppLocale.labels.budgetTypeMonth),
14 0 : ListSelectorItem(id: AppAutomationType.year.name, name: AppLocale.labels.budgetTypeYear),
15 0 : ListSelectorItem(id: AppAutomationType.days.name, name: AppLocale.labels.automationTypeDays),
16 : ];
17 : }
18 :
19 0 : static String getLabel(String id) => getList().firstWhere((e) => e.id == id).name;
20 :
21 0 : static bool contains(String id, List<AppAutomationType> type) => type.map((e) => e.toString()).contains(id);
22 : }
|