class FilterOption {
  final String value;
  final String label;

  const FilterOption({required this.value, required this.label});

  factory FilterOption.fromJson(Map<String, dynamic> json) {
    return FilterOption(
      value: json['value'] as String? ?? '',
      label: json['label'] as String? ?? '',
    );
  }
}

class FilterableField {
  final String slug;
  final String name;
  final String fieldType;
  final List<FilterOption> options;

  const FilterableField({
    required this.slug,
    required this.name,
    required this.fieldType,
    this.options = const [],
  });

  factory FilterableField.fromJson(Map<String, dynamic> json) {
    return FilterableField(
      slug: json['slug'] as String? ?? '',
      name: json['name'] as String? ?? '',
      fieldType: json['fieldType'] as String? ?? '',
      options: (json['options'] as List<dynamic>?)
              ?.map((e) => FilterOption.fromJson(e as Map<String, dynamic>))
              .toList() ??
          const [],
    );
  }
}
