import 'dart:ffi';

import 'enums.dart';

part 'myid_config.g.dart';

class MyIdConfig {
  final String clientId;
  final String? clientHash;
  final String? clientHashId;
  final String? passportData;
  final String? dateOfBirth;
  final Int? minAge;
  final String? sdkHash;
  final String? externalId;
  final double? threshold;
  final MyIdBuildMode? buildMode;
  final MyIdEntryType? entryType;
  final MyIdResidentType? residency;
  final MyIdLocale? locale;
  final MyIdCameraShape? cameraShape;
  final MyIdResolution? resolution;
  final MyIdImageFormat? imageFormat;
  final MyIdOrganizationDetails? organizationDetails;
  final bool? withPhoto;

  MyIdConfig({
    required this.clientId,
    this.clientHash,
    this.clientHashId,
    this.passportData,
    this.dateOfBirth,
    this.minAge,
    this.sdkHash,
    this.externalId,
    this.threshold,
    this.buildMode,
    this.entryType,
    this.residency,
    this.locale,
    this.cameraShape,
    this.resolution,
    this.imageFormat,
    this.organizationDetails,
    this.withPhoto,
  });

  factory MyIdConfig.fromJson(Map<String, dynamic> json) =>
      _$MyIdConfigFromJson(json);

  Map<String, dynamic> toJson() => _$MyIdConfigToJson(this);
}

class MyIdResult {
  final String? code;
  final String? comparison;
  final String? base64;

  MyIdResult({
    this.code,
    this.comparison,
    this.base64
  });

  factory MyIdResult.fromJson(Map<String, dynamic> json) =>
      _$MyIdResultFromJson(json);
}

class MyIdOrganizationDetails {
  final String? phone;

  const MyIdOrganizationDetails({
    required this.phone
  });

  factory MyIdOrganizationDetails.fromJson(Map<String, dynamic> json) =>
      _$MyIdOrganizationDetailsFromJson(json);

  Map<String, dynamic> toJson() => _$MyIdOrganizationDetailsToJson(this);
}

class MyIdIOSAppearance {
  final String? primaryColor;
  final String? errorColor;
  final String? primaryButtonColor;
  final String? primaryButtonColorDisabled;
  final String? primaryButtonTextColor;
  final String? primaryButtonTextColorDisabled;
  final int? buttonCornerRadius;

  const MyIdIOSAppearance({
    this.primaryColor,
    this.errorColor,
    this.primaryButtonColor,
    this.primaryButtonColorDisabled,
    this.primaryButtonTextColor,
    this.primaryButtonTextColorDisabled,
    this.buttonCornerRadius,
  });

  factory MyIdIOSAppearance.fromJson(Map<String, dynamic> json) =>
      _$MyIdIOSAppearanceFromJson(json);

  Map<String, dynamic> toJson() => _$MyIdIOSAppearanceToJson(this);
}
