// import 'package:flutter/material.dart';
// import 'base_field.dart';
// import 'dependent_dropdown_field.dart';
// import 'dropdown_field.dart';

// /// Example usage of DependentDropdownField
// /// This demonstrates how to create cascading dropdowns with API calls
// class DependentDropdownExample {
//   /// Example field definitions for a location form with country -> state -> district
//   static List<BaseField> getLocationFields() {
//     return [
//       // Parent dropdown - Country selection
//       DropdownField(
//         fieldKey: 'country',
//         label: 'Country',
//         hint: 'Select country',
//         options: const [
//           {'id': 'india', 'name': 'India'},
//           {'id': 'usa', 'name': 'United States'},
//           {'id': 'canada', 'name': 'Canada'},
//         ],
//         valueKey: 'id',
//         displayKey: 'name',
//       ),

//       // Dependent dropdown - State selection (depends on country)
//       DependentDropdownField(
//         fieldKey: 'state',
//         label: 'State',
//         hint: 'Select state',
//         dependentFieldKey: 'country',
//         apiEndpoint: '/State_ListFilter1/State_ListFilter11',
//         valueKey: 'state_name',
//         displayKey: 'state_name',
//         dependentValueKey:
//             'name', // This is the field from country that gets passed to API
//       ),

//       // Dependent dropdown - District selection (depends on state)
//       DependentDropdownField(
//         fieldKey: 'district',
//         label: 'District',
//         hint: 'Select district',
//         dependentFieldKey: 'state',
//         apiEndpoint: '/District_ListFilter1/District_ListFilter11',
//         valueKey: 'district_name',
//         displayKey: 'district_name',
//         dependentValueKey:
//             'state_name', // This is the field from state that gets passed to API
//       ),
//     ];
//   }

//   /// Example field definitions for a product form with category -> subcategory -> product
//   static List<BaseField> getProductFields() {
//     return [
//       // Parent dropdown - Category selection
//       DropdownField(
//         fieldKey: 'category',
//         label: 'Category',
//         hint: 'Select category',
//         options: const [
//           {'id': 'electronics', 'name': 'Electronics'},
//           {'id': 'clothing', 'name': 'Clothing'},
//           {'id': 'books', 'name': 'Books'},
//         ],
//         valueKey: 'id',
//         displayKey: 'name',
//       ),

//       // Dependent dropdown - Subcategory selection (depends on category)
//       DependentDropdownField(
//         fieldKey: 'subcategory',
//         label: 'Subcategory',
//         hint: 'Select subcategory',
//         dependentFieldKey: 'category',
//         apiEndpoint: '/Subcategory_ListFilter1/Subcategory_ListFilter11',
//         valueKey: 'subcategory_id',
//         displayKey: 'subcategory_name',
//         dependentValueKey: 'name',
//       ),

//       // Dependent dropdown - Product selection (depends on subcategory)
//       DependentDropdownField(
//         fieldKey: 'product',
//         label: 'Product',
//         hint: 'Select product',
//         dependentFieldKey: 'subcategory',
//         apiEndpoint: '/Product_ListFilter1/Product_ListFilter11',
//         valueKey: 'product_id',
//         displayKey: 'product_name',
//         dependentValueKey: 'subcategory_name',
//       ),
//     ];
//   }
// }

// /// How the DependentDropdownField works:
// /// 
// /// 1. **Parent Field Selection**: When user selects a value in the parent field (e.g., country)
// /// 2. **API Call Triggered**: The dependent field automatically detects the change
// /// 3. **API Call Made**: Calls the specified API endpoint with the parent field value
// /// 4. **Options Loaded**: The API response is parsed and options are populated
// /// 5. **UI Updated**: The dropdown shows the new options
// /// 6. **Cascading Effect**: If there are more dependent fields, they get cleared and wait for new selection
// /// 
// /// **API Endpoint Format**:
// /// - Base URL: `ApiConstants.baseUrl`
// /// - Endpoint: `/State_ListFilter1/State_ListFilter11/{dependentValue}`
// /// - Example: `https://api.example.com/State_ListFilter1/State_ListFilter11/india`
// /// 
// /// **API Response Format**:
// /// ```json
// /// [
// ///   {
// ///     "state_name": "Maharashtra",
// ///     "state_id": "1"
// ///   },
// ///   {
// ///     "state_name": "Karnataka", 
// ///     "state_id": "2"
// ///   }
// /// ]
// /// ```
// /// 
// /// **Key Features**:
// /// - â **Automatic API Calls**: No manual API handling needed
// /// - â **Loading States**: Shows loading indicator while fetching data
// /// - â **Error Handling**: Displays error messages if API fails
// /// - â **Cascading Clear**: Dependent fields clear when parent changes
// /// - â **Form Integration**: Works seamlessly with EntityForm
// /// - â **Theme Support**: Uses DynamicThemeProvider for consistent styling
// /// - â **Validation**: Built-in required field validation
// /// - â **Responsive**: Works on all screen sizes
// /// 
// /// **Usage in Entity**:
// /// ```dart
// /// // In your entity fields file
// /// class MyEntityFields {
// ///   static List<BaseField> getFields() {
// ///     return [
// ///       DropdownField(
// ///         fieldKey: 'country',
// ///         label: 'Country',
// ///         options: countryOptions,
// ///       ),
// ///       DependentDropdownField(
// ///         fieldKey: 'state',
// ///         label: 'State',
// ///         dependentFieldKey: 'country',
// ///         apiEndpoint: '/State_ListFilter1/State_ListFilter11',
// ///         valueKey: 'state_name',
// ///         displayKey: 'state_name',
// ///         dependentValueKey: 'name',
// ///       ),
// ///     ];
// ///   }
// /// }
// /// ```
