import 'package:base_project/BuilderField/shared/fields/number_field.dart';
import 'package:base_project/BuilderField/shared/fields/password_field.dart';
import 'package:base_project/BuilderField/shared/fields/phone_field.dart';
import 'package:base_project/BuilderField/shared/fields/custom_text_field.dart';

import '../../../../BuilderField/shared/fields/base_field.dart';

import '../../../../BuilderField/shared/fields/date_field.dart';
import '../../../../BuilderField/shared/fields/datetime_field.dart';
import '../../../../BuilderField/shared/fields/email_field.dart';
import 'package:base_project/BuilderField/shared/fields/url_field.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../../../../BuilderField/shared/fields/custom_text_field.dart' as shared_text;
import '../../../../BuilderField/shared/fields/one_to_one_relation_field.dart';
import '../../../../BuilderField/shared/fields/calculated_field.dart';
import '../../../../BuilderField/shared/fields/one_to_many_field.dart';
import '../../../../BuilderField/shared/fields/value_list_picker_field.dart';
import '../../../../BuilderField/shared/fields/captcha_field.dart';
import '../../../../BuilderField/shared/fields/switch_field.dart';
import '../../../../BuilderField/shared/fields/url_field.dart';

import '../../../../BuilderField/shared/fields/audio_upload_field.dart';
import '../../../../BuilderField/shared/fields/checkbox_field.dart';
import '../../../../BuilderField/shared/fields/file_upload_field.dart';
import '../../../../BuilderField/shared/fields/image_upload_field.dart';
import '../../../../BuilderField/shared/fields/radio_field.dart';
import '../../../../BuilderField/shared/fields/video_upload_field.dart';

import '../../../../BuilderField/shared/fields/autocomplete_dropdown_field.dart';
import '../../../../BuilderField/shared/fields/autocomplete_multiselect_field.dart';
import '../../../../BuilderField/shared/fields/one_to_one_relation_field.dart';
import '../../../../BuilderField/shared/fields/data_grid_field.dart';
import '../../../../BuilderField/shared/fields/dropdown_field.dart';
import '../../../../BuilderField/shared/fields/dynamic_dropdown_field.dart';
import '../../../../BuilderField/shared/fields/dynamic_multiselect_dropdown_field.dart';
import '../../../../BuilderField/shared/fields/static_multiselect_field.dart';
import '../../../../BuilderField/shared/fields/currency_field.dart';
import '../../../../BuilderField/shared/fields/field_group_field.dart';
import '../../../../BuilderField/shared/fields/qr_code_field.dart';
import '../../../../BuilderField/shared/fields/barcode_field.dart';
import '../Adv3_viewModel/Adv3_view_model_screen.dart';/// Field definitions for Adv3 entity
/// This defines the structure and validation for Adv3 forms
class Adv3Fields {
  /// Get field definitions for Adv3 entity
  static List<BaseField> getFields(BuildContext context) {
    final viewModel =
        Provider.of<Adv3ViewModelScreen>(context, listen: false);
    return [
      // Basic Information
  DataGridField(
        fieldKey: 'datagrid_field',
        label: 'datagrid Field',
        dataLoader: () => viewModel.getdatagrid_fieldGrid(),
      ),

  DataGridField(
        fieldKey: 'datagrid_field2',
        label: 'datagrid Field2',
        dataLoader: () => viewModel.getdatagrid_field2Grid(),
      ),

DropdownField(
        fieldKey: 'country',
        label: 'country',
        hint: 'Select country',
        options: const [

 
          {'id': 'bharat', 'name': 'bharat'},

 

 
          {'id': 'nepal', 'name': 'nepal'},

 

 
          {'id': 'bhutan', 'name': 'bhutan'},

 


        
        ],
        valueKey: 'id',
        displayKey: 'name',
      ),

DropdownField(
        fieldKey: 'state',
        label: 'state',
        hint: 'Select state',
        options: const [

 
          {'id': 'maharastra', 'name': 'maharastra'},

 

 
          {'id': 'bihar', 'name': 'bihar'},

 

 
          {'id': 'test', 'name': 'test'},

 


        
        ],
        valueKey: 'id',
        displayKey: 'name',
      ),

 StaticMultiSelectField(
        fieldKey: 'stmlit',
        label: 'Select stmlit',
        options: const [

 
'bihar',
    

 
'sikkim',
    



],
      ),


 StaticMultiSelectField(
        fieldKey: 'stmmlt2',
        label: 'Select stmmlt2',
        options: const [

 
'p2',
    

 
'p3',
    

 
'ap',
    



],
      ),


 DynamicDropdownField(
        fieldKey: 'dy2',
        label: 'Select dy2',
         hint: 'Search and select',
        optionsLoader: () => viewModel.getdy2(),

 
        valueKey: 'id',
        displayKey: 'name',
 

      ),


 DynamicDropdownField(
        fieldKey: 'dy1',
        label: 'Select dy1',
         hint: 'Search and select',
        optionsLoader: () => viewModel.getdy1(),

 
        valueKey: 'id',
        displayKey: 'description',
 

      ),


 DynamicMultiSelectDropdownField(
        fieldKey: 'dymlti1',
        label: 'dymlti1',
        hint: 'Type to search and press enter',
        optionsLoader: () async {
          final list = await viewModel.getdymlti1();
          return list

 
              .map((e) => e['name']?.toString() ?? '')
              .where((e) => e.isNotEmpty)
              .toList();
 

        },
      ),


 DynamicMultiSelectDropdownField(
        fieldKey: 'dymlt2',
        label: 'dymlt2',
        hint: 'Type to search and press enter',
        optionsLoader: () async {
          final list = await viewModel.getdymlt2();
          return list

 
              .map((e) => e['description']?.toString() ?? '')
              .where((e) => e.isNotEmpty)
              .toList();
 

        },
      ),


    ];
  }
}
