// Example usage of TimePickerWidget
//
// This file demonstrates how to use the TimePickerWidget in your Flutter app.
// The TimePickerWidget is a reusable component that shows a bottom sheet with
// an iOS-style time picker.

// ============================================================================
// EXAMPLE 1: Using with TextInputWidget
// ============================================================================
/*
TextInputWidget(
  labelText: "Appointment Time",
  hintText: "Select time",
  controller: timeController,
  selectionType: SelectionTypeEnum.time,
  isReadOnly: true,
  onChange: (value) {
    print("Selected time: $value");
  },
)
*/

// ============================================================================
// EXAMPLE 2: Direct usage with custom button
// ============================================================================
/*
ElevatedButton(
  onPressed: () async {
    final selectedTime = await TimePickerWidget.show(
      context,
      initialTime: TimeOfDay.now(),
      use24HourFormat: false,
      onTimeSelected: (time) {
        print("Time selected: ${TimePickerWidget.formatTime(time)}");
      },
    );

    if (selectedTime != null) {
      print("Final time: ${TimePickerWidget.formatTime(selectedTime)}");
    }
  },
  child: Text("Pick Time"),
)
*/

// ============================================================================
// EXAMPLE 3: Using with 24-hour format
// ============================================================================
/*
TextInputWidget(
  labelText: "Meeting Time",
  hintText: "Select time (24h)",
  controller: timeController,
  selectionType: SelectionTypeEnum.time,
  isReadOnly: true,
  onChange: (value) {
    // The value will be formatted as "14:30" for 2:30 PM in 24h format
    print("Selected time (24h): $value");
  },
)

// Or programmatically:
final time = await TimePickerWidget.show(
  context,
  use24HourFormat: true, // Enable 24-hour format
);
*/

// ============================================================================
// EXAMPLE 4: Parsing and formatting times
// ============================================================================
/*
// Parse time string to TimeOfDay
String timeString = "02:30 PM";
TimeOfDay? parsedTime = TimePickerWidget.parseTime(timeString);

// Format TimeOfDay to string
TimeOfDay time = TimeOfDay(hour: 14, minute: 30);
String formatted12h = TimePickerWidget.formatTime(time); // "02:30 PM"
String formatted24h = TimePickerWidget.formatTime(time, use24HourFormat: true); // "14:30"
*/

// ============================================================================
// EXAMPLE 5: Complete form example with date and time
// ============================================================================
/*
class AppointmentForm extends StatefulWidget {
  @override
  _AppointmentFormState createState() => _AppointmentFormState();
}

class _AppointmentFormState extends State<AppointmentForm> {
  final TextEditingController dateController = TextEditingController();
  final TextEditingController timeController = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        // Date picker
        TextInputWidget(
          labelText: "Appointment Date",
          hintText: "Select date",
          controller: dateController,
          selectionType: SelectionTypeEnum.calendar,
          isReadOnly: true,
          onChange: (value) {
            print("Date selected: $value");
          },
        ),

        SizedBox(height: 16),

        // Time picker
        TextInputWidget(
          labelText: "Appointment Time",
          hintText: "Select time",
          controller: timeController,
          selectionType: SelectionTypeEnum.time,
          isReadOnly: true,
          onChange: (value) {
            print("Time selected: $value");
          },
        ),
      ],
    );
  }
}
*/

// ============================================================================
// Features:
// ============================================================================
// ✅ iOS-style cupertino picker (works on both iOS and Android)
// ✅ Support for 12-hour format (with AM/PM)
// ✅ Support for 24-hour format
// ✅ Beautiful bottom sheet UI matching app design
// ✅ Real-time preview of selected time
// ✅ Confirm/Cancel buttons
// ✅ Easy integration with TextInputWidget
// ✅ Parse and format time utilities
// ✅ Fully customizable and reusable

// ============================================================================
// API Reference:
// ============================================================================
// TimePickerWidget.show() - Shows the time picker bottom sheet
//   Parameters:
//   - context: BuildContext (required)
//   - initialTime: TimeOfDay? (optional, defaults to current time)
//   - use24HourFormat: bool (optional, defaults to false)
//   - onTimeSelected: Function(TimeOfDay)? (optional callback)
//   Returns: Future<TimeOfDay?>
//
// TimePickerWidget.formatTime() - Formats TimeOfDay to string
//   Parameters:
//   - time: TimeOfDay (required)
//   - use24HourFormat: bool (optional, defaults to false)
//   Returns: String (e.g., "02:30 PM" or "14:30")
//
// TimePickerWidget.parseTime() - Parses time string to TimeOfDay
//   Parameters:
//   - timeString: String (required, e.g., "02:30 PM")
//   Returns: TimeOfDay?

