//--------------------------------------------------------------------------------------------------
// Copyright (c) id3 Technologies
// All Rights Reserved.
//--------------------------------------------------------------------------------------------------
import 'dart:ffi';
import 'package:ffi/ffi.dart';
import 'face_sdk_generated_bindings.dart';

/// Contains data for LibVersion
class LibVersion {
  final Pointer<id3FaceLibVersion> _handle;

  static final Finalizer<Pointer<id3FaceLibVersion>> _finalizer = Finalizer((handle) => calloc.free(handle));

  Pointer<id3FaceLibVersion> get handle => _handle;

  id3FaceLibVersion get struct => _handle.ref;

  /// Initializes a new instance of the LibVersion class from its members.
  LibVersion(this._handle);

  /// Create a new instance of the LibVersion.
  LibVersion.create() : _handle = calloc() {
    _finalizer.attach(this, _handle, detach: this);
  }

  /// Create a new instance of the LibVersion from the native struct
  LibVersion.createFromStruct(id3FaceLibVersion value) : _handle = calloc() {
    _handle.ref.Major = value.Major;
    _handle.ref.Minor = value.Minor;
    _handle.ref.Build = value.Build;
    _finalizer.attach(this, _handle, detach: this);
  }

  void dispose() {
    calloc.free(_handle);
    _finalizer.detach(this);
  }

  // Accessors
  
  /// 
  /// Version.
  /// 
  /// throws FaceException An error has occurred during Face Library execution.
  int get major => _handle.ref.Major;
  set major(int value) => _handle.ref.Major = value;

  /// 
  /// Release.
  /// 
  /// throws FaceException An error has occurred during Face Library execution.
  int get minor => _handle.ref.Minor;
  set minor(int value) => _handle.ref.Minor = value;

  /// 
  /// Build.
  /// 
  /// throws FaceException An error has occurred during Face Library execution.
  int get build => _handle.ref.Build;
  set build(int value) => _handle.ref.Build = value;


  Map<String, dynamic> toMap() {
    return {
        'major': major,
        'minor': minor,
        'build': build,
    };
  }
}
