/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * 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
 *
 *      http://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 com.android.server.people;

option java_multiple_files = true;

import "frameworks/base/core/proto/android/content/locusid.proto";
import "frameworks/base/core/proto/android/privacy.proto";

// On disk data of conversation infos for a user and app package.
message ConversationInfosProto {

  // The series of conversation infos for a user and app package.
  repeated ConversationInfoProto conversation_infos = 1;
}

// Individual conversation info (com.android.server.people.data.ConversationInfo) for a user
// and app package.
message ConversationInfoProto {

  // The conversation's shortcut id.
  optional string shortcut_id = 1;

  // The conversation's locus id.
  optional .android.content.LocusIdProto locus_id_proto = 2;

  // The URI of the contact in the conversation.
  optional string contact_uri = 3 [(.android.privacy).dest = DEST_EXPLICIT];

  // The notification channel id of the conversation.
  optional string notification_channel_id = 4 [(.android.privacy).dest = DEST_EXPLICIT];

  // The parent notification channel ID of the conversation. This is the notification channel where
  // the notifications are posted before this conversation is customized by the user.
  optional string parent_notification_channel_id = 8 [(.android.privacy).dest = DEST_EXPLICIT];

  // Integer representation of shortcut bit flags.
  optional int32 shortcut_flags = 5;

  // Integer representation of conversation bit flags.
  optional int32 conversation_flags = 6;

  // The phone number of the contact.
  optional string contact_phone_number = 7 [(.android.privacy).dest = DEST_EXPLICIT];

  // The timestamp of the last event in millis.
  optional int64 last_event_timestamp = 9;

  // The timestamp this conversation was created in millis.
  optional int64 creation_timestamp = 10;

  // Next tag: 11
}

// On disk data of events.
message PeopleEventsProto {
  repeated PeopleEventProto events = 1;
}

// Individual event (com.android.server.people.data.Event).
message PeopleEventProto {

  // For valid values, refer to java class documentation.
  optional int32 event_type = 1;

  optional int64 time = 2;

  // The duration of the event. Should only be set for some event_types. Refer to java class
  // documentation for details.
  optional int32 duration = 3;
}

// On disk data of event indexes.
message PeopleEventIndexesProto {
  repeated TypedPeopleEventIndexProto typed_indexes = 1;
}

// Mapping of event_type to event index.
message TypedPeopleEventIndexProto {
  optional int32 event_type = 1;
  optional PeopleEventIndexProto index = 2;
}

// Index of events' time distributions (com.android.server.people.data.EventIndex).
message PeopleEventIndexProto {
  // Each long value in event_bitmaps represents a time slot, there should be 4 values. Further
  // details can be found in class documentation.
  repeated int64 event_bitmaps = 1;

  optional int64 last_updated_time = 2;
}

