import 'package:flutter/gestures.dart';
import 'package:flut/flut/object.dart';
import 'package:flut/dart/ui.dart';

class FlutDragStartDetails extends FlutImmutableObject {
  final DragStartDetails details;

  const FlutDragStartDetails(this.details) : super('DragStartDetails');

  @override
  Map<String, dynamic> flutEncode() {
    final result = flutBaseProps();
    result['globalPosition'] = FlutOffset(details.globalPosition).flutEncode();
    result['localPosition'] = FlutOffset(details.localPosition).flutEncode();
    return result;
  }
}

class FlutDragUpdateDetails extends FlutImmutableObject {
  final DragUpdateDetails details;

  const FlutDragUpdateDetails(this.details) : super('DragUpdateDetails');

  @override
  Map<String, dynamic> flutEncode() {
    final result = flutBaseProps();
    result['globalPosition'] = FlutOffset(details.globalPosition).flutEncode();
    result['localPosition'] = FlutOffset(details.localPosition).flutEncode();
    result['delta'] = FlutOffset(details.delta).flutEncode();
    return result;
  }
}

class FlutVelocity extends FlutImmutableObject {
  final Velocity velocity;

  const FlutVelocity(this.velocity) : super('Velocity');

  @override
  Map<String, dynamic> flutEncode() {
    final result = flutBaseProps();
    result['pixelsPerSecond'] = FlutOffset(
      velocity.pixelsPerSecond,
    ).flutEncode();
    return result;
  }
}

class FlutDragEndDetails extends FlutImmutableObject {
  final DragEndDetails details;

  const FlutDragEndDetails(this.details) : super('DragEndDetails');

  @override
  Map<String, dynamic> flutEncode() {
    final result = flutBaseProps();
    result['velocity'] = FlutVelocity(details.velocity).flutEncode();
    result['globalPosition'] = FlutOffset(details.globalPosition).flutEncode();
    result['localPosition'] = FlutOffset(details.localPosition).flutEncode();
    return result;
  }
}
