Skip to content

Commit 828a590

Browse files
committed
feat(search): add SearchModelType enum
- Defines searchable model types - Includes display names - Includes toJson method
1 parent dfdd677 commit 828a590

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/// Defines the types of models that can be searched.
2+
enum SearchModelType {
3+
headline,
4+
category,
5+
country,
6+
source;
7+
8+
/// Returns a user-friendly display name for the enum value.
9+
///
10+
/// This should ideally be localized using context.l10n,
11+
/// but for simplicity in this step, we'll use direct strings.
12+
/// TODO(Cline): Localize these display names.
13+
String get displayName {
14+
switch (this) {
15+
case SearchModelType.headline:
16+
return 'Headlines';
17+
case SearchModelType.category:
18+
return 'Categories';
19+
case SearchModelType.country:
20+
return 'Countries';
21+
case SearchModelType.source:
22+
return 'Sources';
23+
}
24+
}
25+
26+
/// Returns the string representation for API query parameters.
27+
String toJson() => name;
28+
}

0 commit comments

Comments
 (0)