// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto2";

package nearby.proto.fastpair;

// import "logs/proto/logs_annotations/logs_annotations.proto";

// option (logs_proto.file_not_used_for_logging_except_enums) = true;
option optimize_for = LITE_RUNTIME;
// option java_api_version = 2;
option java_package = "nearby.proto.fastpair";
option java_outer_classname = "FastPairEnums";
option objc_class_prefix = "GNFP";

// Enums related to logged events. For event codes, see NearbyEventCodes.
message FastPairEvent {
  // These numbers match BluetoothDevice on Android:
  // http://cs/android/frameworks/base/core/java/android/bluetooth/BluetoothDevice.java?l=283&rcl=0d05da79fb6c0fb04f6ebd3cc16265c5ff9e6764
  enum BondState {
    UNKNOWN_BOND_STATE = 0;
    NONE = 10;
    BONDING = 11;
    BONDED = 12;
  }

  // Generally applicable error codes.
  enum ErrorCode {
    UNKNOWN_ERROR_CODE = 0;

    // Check the other fields for a more specific error code.
    OTHER_ERROR = 1;

    // The operation timed out.
    TIMEOUT = 2;

    // The thread was interrupted.
    INTERRUPTED = 3;

    // Some reflective call failed (should never happen).
    REFLECTIVE_OPERATION_EXCEPTION = 4;

    // A Future threw an exception (should never happen).
    EXECUTION_EXCEPTION = 5;

    // Parsing something (e.g. BR/EDR Handover data) failed.
    PARSE_EXCEPTION = 6;

    // A failure at MDH.
    MDH_REMOTE_EXCEPTION = 7;

    // For errors on GATT connection and retry success
    SUCCESS_RETRY_GATT_ERROR = 8;

    // For timeout on GATT connection and retry success
    SUCCESS_RETRY_GATT_TIMEOUT = 9;

    // For errors on secret handshake and retry success
    SUCCESS_RETRY_SECRET_HANDSHAKE_ERROR = 10;

    // For timeout on secret handshake and retry success
    SUCCESS_RETRY_SECRET_HANDSHAKE_TIMEOUT = 11;

    // For secret handshake fail and restart GATT connection success
    SUCCESS_SECRET_HANDSHAKE_RECONNECT = 12;

    // For address rotate and retry with new address success
    SUCCESS_ADDRESS_ROTATE = 13;

    // For signal lost and retry with old address still success
    SUCCESS_SIGNAL_LOST = 14;

    // For the provider is not in paired history to let the subsequent pair fail
    DEVICE_NOT_IN_PAIRED_HISTORY_EXCEPTION = 15;

    // For device not bonded during retroactive pair.
    DEVICE_NOT_BONDED_DURING_RETROACTIVE_PAIR = 16;
  }

  enum BrEdrHandoverErrorCode {
    UNKNOWN_BR_EDR_HANDOVER_ERROR_CODE = 0;
    CONTROL_POINT_RESULT_CODE_NOT_SUCCESS = 1;
    BLUETOOTH_MAC_INVALID = 2;
    TRANSPORT_BLOCK_INVALID = 3;
  }

  enum CreateBondErrorCode {
    UNKNOWN_BOND_ERROR_CODE = 0;
    BOND_BROKEN = 1;
    POSSIBLE_MITM = 2;
    NO_PERMISSION = 3;
    INCORRECT_VARIANT = 4;
    FAILED_BUT_ALREADY_RECEIVE_PASS_KEY = 5;
  }

  enum ConnectErrorCode {
    UNKNOWN_CONNECT_ERROR_CODE = 0;
    UNSUPPORTED_PROFILE = 1;
    GET_PROFILE_PROXY_FAILED = 2;
    DISCONNECTED = 3;
    LINK_KEY_CLEARED = 4;
    FAIL_TO_DISCOVERY = 5;
    DISCOVERY_NOT_FINISHED = 6;
  }
}

enum DeviceType {
  UNKNOWN_DEVICE_TYPE = 0;
  PHONE = 1;
  WEARABLE = 2;
  AUTO = 3;
  PC = 4;
  TV = 5;
  TABLET = 6;
}

enum OsType {
  UNKNOWN_OS_TYPE = 0;
  ANDROID = 1;
  CHROME_OS = 2;
}
