// Copyright 2013 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v22.4.2), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import, no_leading_underscores_for_local_identifiers
// ignore_for_file: avoid_relative_lib_imports
import 'dart:async';
import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:path_provider_android/messages.g.dart';

class _PigeonCodec extends StandardMessageCodec {
  const _PigeonCodec();
  @override
  void writeValue(WriteBuffer buffer, Object? value) {
    if (value is int) {
      buffer.putUint8(4);
      buffer.putInt64(value);
    } else if (value is StorageDirectory) {
      buffer.putUint8(129);
      writeValue(buffer, value.index);
    } else {
      super.writeValue(buffer, value);
    }
  }

  @override
  Object? readValueOfType(int type, ReadBuffer buffer) {
    switch (type) {
      case 129:
        final int? value = readValue(buffer) as int?;
        return value == null ? null : StorageDirectory.values[value];
      default:
        return super.readValueOfType(type, buffer);
    }
  }
}

abstract class TestPathProviderApi {
  static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding =>
      TestDefaultBinaryMessengerBinding.instance;
  static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();

  String? getTemporaryPath();

  String? getApplicationSupportPath();

  String? getApplicationDocumentsPath();

  String? getApplicationCachePath();

  String? getExternalStoragePath();

  List<String> getExternalCachePaths();

  List<String> getExternalStoragePaths(StorageDirectory directory);

  static void setUp(
    TestPathProviderApi? api, {
    BinaryMessenger? binaryMessenger,
    String messageChannelSuffix = '',
  }) {
    messageChannelSuffix =
        messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
    {
      final BasicMessageChannel<Object?>
      pigeonVar_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.path_provider_android.PathProviderApi.getTemporaryPath$messageChannelSuffix',
        pigeonChannelCodec,
        binaryMessenger: binaryMessenger,
      );
      if (api == null) {
        _testBinaryMessengerBinding!.defaultBinaryMessenger
            .setMockDecodedMessageHandler<Object?>(pigeonVar_channel, null);
      } else {
        _testBinaryMessengerBinding!.defaultBinaryMessenger
            .setMockDecodedMessageHandler<Object?>(pigeonVar_channel, (
              Object? message,
            ) async {
              try {
                final String? output = api.getTemporaryPath();
                return <Object?>[output];
              } on PlatformException catch (e) {
                return wrapResponse(error: e);
              } catch (e) {
                return wrapResponse(
                  error: PlatformException(
                    code: 'error',
                    message: e.toString(),
                  ),
                );
              }
            });
      }
    }
    {
      final BasicMessageChannel<Object?>
      pigeonVar_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.path_provider_android.PathProviderApi.getApplicationSupportPath$messageChannelSuffix',
        pigeonChannelCodec,
        binaryMessenger: binaryMessenger,
      );
      if (api == null) {
        _testBinaryMessengerBinding!.defaultBinaryMessenger
            .setMockDecodedMessageHandler<Object?>(pigeonVar_channel, null);
      } else {
        _testBinaryMessengerBinding!.defaultBinaryMessenger
            .setMockDecodedMessageHandler<Object?>(pigeonVar_channel, (
              Object? message,
            ) async {
              try {
                final String? output = api.getApplicationSupportPath();
                return <Object?>[output];
              } on PlatformException catch (e) {
                return wrapResponse(error: e);
              } catch (e) {
                return wrapResponse(
                  error: PlatformException(
                    code: 'error',
                    message: e.toString(),
                  ),
                );
              }
            });
      }
    }
    {
      final BasicMessageChannel<Object?>
      pigeonVar_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.path_provider_android.PathProviderApi.getApplicationDocumentsPath$messageChannelSuffix',
        pigeonChannelCodec,
        binaryMessenger: binaryMessenger,
      );
      if (api == null) {
        _testBinaryMessengerBinding!.defaultBinaryMessenger
            .setMockDecodedMessageHandler<Object?>(pigeonVar_channel, null);
      } else {
        _testBinaryMessengerBinding!.defaultBinaryMessenger
            .setMockDecodedMessageHandler<Object?>(pigeonVar_channel, (
              Object? message,
            ) async {
              try {
                final String? output = api.getApplicationDocumentsPath();
                return <Object?>[output];
              } on PlatformException catch (e) {
                return wrapResponse(error: e);
              } catch (e) {
                return wrapResponse(
                  error: PlatformException(
                    code: 'error',
                    message: e.toString(),
                  ),
                );
              }
            });
      }
    }
    {
      final BasicMessageChannel<Object?>
      pigeonVar_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.path_provider_android.PathProviderApi.getApplicationCachePath$messageChannelSuffix',
        pigeonChannelCodec,
        binaryMessenger: binaryMessenger,
      );
      if (api == null) {
        _testBinaryMessengerBinding!.defaultBinaryMessenger
            .setMockDecodedMessageHandler<Object?>(pigeonVar_channel, null);
      } else {
        _testBinaryMessengerBinding!.defaultBinaryMessenger
            .setMockDecodedMessageHandler<Object?>(pigeonVar_channel, (
              Object? message,
            ) async {
              try {
                final String? output = api.getApplicationCachePath();
                return <Object?>[output];
              } on PlatformException catch (e) {
                return wrapResponse(error: e);
              } catch (e) {
                return wrapResponse(
                  error: PlatformException(
                    code: 'error',
                    message: e.toString(),
                  ),
                );
              }
            });
      }
    }
    {
      final BasicMessageChannel<Object?>
      pigeonVar_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.path_provider_android.PathProviderApi.getExternalStoragePath$messageChannelSuffix',
        pigeonChannelCodec,
        binaryMessenger: binaryMessenger,
      );
      if (api == null) {
        _testBinaryMessengerBinding!.defaultBinaryMessenger
            .setMockDecodedMessageHandler<Object?>(pigeonVar_channel, null);
      } else {
        _testBinaryMessengerBinding!.defaultBinaryMessenger
            .setMockDecodedMessageHandler<Object?>(pigeonVar_channel, (
              Object? message,
            ) async {
              try {
                final String? output = api.getExternalStoragePath();
                return <Object?>[output];
              } on PlatformException catch (e) {
                return wrapResponse(error: e);
              } catch (e) {
                return wrapResponse(
                  error: PlatformException(
                    code: 'error',
                    message: e.toString(),
                  ),
                );
              }
            });
      }
    }
    {
      final BasicMessageChannel<Object?>
      pigeonVar_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.path_provider_android.PathProviderApi.getExternalCachePaths$messageChannelSuffix',
        pigeonChannelCodec,
        binaryMessenger: binaryMessenger,
      );
      if (api == null) {
        _testBinaryMessengerBinding!.defaultBinaryMessenger
            .setMockDecodedMessageHandler<Object?>(pigeonVar_channel, null);
      } else {
        _testBinaryMessengerBinding!.defaultBinaryMessenger
            .setMockDecodedMessageHandler<Object?>(pigeonVar_channel, (
              Object? message,
            ) async {
              try {
                final List<String> output = api.getExternalCachePaths();
                return <Object?>[output];
              } on PlatformException catch (e) {
                return wrapResponse(error: e);
              } catch (e) {
                return wrapResponse(
                  error: PlatformException(
                    code: 'error',
                    message: e.toString(),
                  ),
                );
              }
            });
      }
    }
    {
      final BasicMessageChannel<Object?>
      pigeonVar_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.path_provider_android.PathProviderApi.getExternalStoragePaths$messageChannelSuffix',
        pigeonChannelCodec,
        binaryMessenger: binaryMessenger,
      );
      if (api == null) {
        _testBinaryMessengerBinding!.defaultBinaryMessenger
            .setMockDecodedMessageHandler<Object?>(pigeonVar_channel, null);
      } else {
        _testBinaryMessengerBinding!.defaultBinaryMessenger
            .setMockDecodedMessageHandler<Object?>(pigeonVar_channel, (
              Object? message,
            ) async {
              assert(
                message != null,
                'Argument for dev.flutter.pigeon.path_provider_android.PathProviderApi.getExternalStoragePaths was null.',
              );
              final List<Object?> args = (message as List<Object?>?)!;
              final StorageDirectory? arg_directory =
                  (args[0] as StorageDirectory?);
              assert(
                arg_directory != null,
                'Argument for dev.flutter.pigeon.path_provider_android.PathProviderApi.getExternalStoragePaths was null, expected non-null StorageDirectory.',
              );
              try {
                final List<String> output = api.getExternalStoragePaths(
                  arg_directory!,
                );
                return <Object?>[output];
              } on PlatformException catch (e) {
                return wrapResponse(error: e);
              } catch (e) {
                return wrapResponse(
                  error: PlatformException(
                    code: 'error',
                    message: e.toString(),
                  ),
                );
              }
            });
      }
    }
  }
}
