// Imported from
// //depot/google3/google/internal/chrome/cros/edu/schooltools/v1/session.proto
syntax = "proto3";

package boca;

import "chromeos/ash/components/boca/proto/bundle.proto";
import "chromeos/ash/components/boca/proto/roster.proto";

option optimize_for = LITE_RUNTIME;

// Below copied proto are due to exist in `protobuf_full` source not
// `protobuf_lite`. The former cannot be included into chrome due to its large
// size. Copied from //third_party/protobuf/src/google/protobuf/duration.proto
message Duration {
  int64 seconds = 1;
  int32 nanos = 2;
}

// Copied from //third_party/protobuf/src/google/protobuf/timestamp.proto
// Measured as seconds + nanos from the epoch (00:00:00 UTC on 1 January 1970).
message Timestamp {
  int64 seconds = 1;
  int32 nanos = 2;
}

message Session {
  reserved 8;

  string session_id = 1;

  UserIdentity teacher = 2;

  Roster roster = 3;

  JoinCode join_code = 4;

  map<string, SessionConfig> student_group_configs = 5;

  map<string, StudentStatus> student_statuses = 6;

  Timestamp start_time = 7;

  Duration duration = 11;

  TeacherCaptionsConfig teacher_captions_config = 12;

  string tachyon_group_id = 13;

  bool save_transcript = 9;

  enum SessionState {
    SESSION_STATE_UNKNOWN = 0;

    PLANNING = 1;

    ACTIVE = 2;

    PAST = 3;
  }

  SessionState session_state = 10;
}

message JoinCode {
  bool enabled = 1;

  string code = 2;
}

message SessionConfig {
  OnTaskConfig on_task_config = 1;

  CaptionsConfig captions_config = 2;
}

message OnTaskConfig {
  Bundle active_bundle = 1;

  bool close_previous_locked_bundle = 2;
}

message CaptionsConfig {
  bool captions_enabled = 1;

  bool translations_enabled = 2;

  repeated string allowed_language_codes = 3;
}

enum GeminiEnablementState {
  GEMINI_ENABLEMENT_STATE_UNSPECIFIED = 0;
  GEMINI_ENABLEMENT_STATE_ENABLED = 1;
  GEMINI_ENABLEMENT_STATE_DISABLED = 2;
}

message StudentStatus {
  reserved 2;

  enum StudentState {
    STUDENT_STATE_UNKNOWN = 0;

    NOT_FOUND = 1;

    ADDED = 2;

    ACTIVE = 3;

    REMOVED_BY_OTHER_SESSION = 4;

    REMOVED_BY_BEING_TEACHER = 5;

    REMOVED_BY_TEACHER = 6;

    NOT_ADDED_CONFIGURED_AS_TEACHER = 7;

    NOT_ADDED_NOT_CONFIGURED = 8;
  }

  StudentState state = 1;

  map<string, StudentDevice> devices = 3;

  Timestamp raised_hand_time = 4;

  bool in_tachyon_group = 5;

  GeminiEnablementState gemini_enablement_state = 6;
}

message StudentDevice {
  DeviceInfo info = 1;

  enum StudentDeviceState {
    STUDENT_DEVICE_STATE_UNKNOWN = 0;

    ACTIVE = 1;

    INACTIVE = 2;
  }

  StudentDeviceState state = 2;

  StudentDeviceActivity activity = 3;

  ViewScreenConfig view_screen_config = 4;
}

message ViewScreenConfig {
  enum ViewScreenState {
    UNKNOWN = 0;

    REQUESTED = 1;

    AVAILABLE = 2;

    ACTIVE = 3;

    INACTIVE = 4;

    AVAILABLE_FOR_KIOSK_RECEIVER = 5;
  }

  ViewScreenState view_screen_state = 1;

  ConnectionParameter connection_param = 2;

  ViewScreenDevice view_screen_requester = 3;

  enum AudioPlayback {
    AUDIO_PLAYBACK_UNKNOWN = 0;

    LOCAL_ONLY = 1;

    REMOTE_AND_LOCAL = 2;

    REMOTE_ONLY = 3;
  }

  AudioPlayback audio_playback = 4;
}

message ConnectionParameter {
  string connection_code = 1;
}

message ViewScreenDevice {
  UserIdentity user = 1;

  DeviceInfo info = 2;

  UserIdentity service_account = 3;
}

message DeviceInfo {
  string device_id = 1;

  FeatureSupport feature_support = 2;
}

message FeatureSupport {
  bool view_screen = 1;
}

message StudentDeviceActivity {
  ActiveTab active_tab = 1;

  CaptionsActivity captions_activity = 2;
}

message ActiveTab {
  string url = 1;

  string title = 2;

  string favicon_url = 3;

  Timestamp time_opened = 4;
}

message CaptionsActivity {
  reserved 2, 3;

  string language_code = 1;

  // Set to "false" to denote disabled captions.
  bool enabled = 4;

  Timestamp activity_time = 5;
}

message TeacherCaptionsConfig {
  string capturing_audio_device_id = 1;

  string capturing_audio_language_code = 3;

  map<string, DeviceCaptionsConfig> device_captions_configs = 2;
}

message DeviceCaptionsConfig {
  DeviceInfo device_info = 1;

  bool captions_enabled = 2;

  string language_code = 3;
}
