syntax = "proto2";
option optimize_for = LITE_RUNTIME;

package anbox.protobuf.bridge;

message StructuredError {
  optional uint32 domain = 1;
  optional uint32 code = 2;
}

message Intent {
    optional string action = 1;
    optional string uri = 2;
    optional string type = 3;
    optional string package = 4;
    optional string component = 5;
    repeated string categories = 6;
}

message Rect {
    optional int32 left = 1;
    optional int32 top = 2;
    optional int32 right = 3;
    optional int32 bottom = 4;
}

message Notification {
    required string package_name = 1;
    required string category = 2;
    required string title = 3;
    optional string ticker_text = 4;
    optional string text = 5;
}

message LaunchApplication {
    required Intent intent = 1;
    optional Rect launch_bounds = 2;
    enum Stack {
      DEFAULT = 0;
      FULLSCREEN = 1;
      FREEFORM = 2;
    }
    optional Stack stack = 3 [default = DEFAULT];
}

message SetFocusedTask {
    required int32 id = 1;
}

message RemoveTask {
    required int32 id = 1;
}

message ResizeTask {
    required int32 id = 1;
    required int32 resize_mode = 2;
    required Rect rect = 3;
}

message ClipboardData {
    optional string text = 1;

    optional string error = 127;
    optional StructuredError structured_error = 128;
}

message BootFinishedEvent {
    optional bool first_boot_done = 1;
}

message WindowStateUpdateEvent {
    message WindowState {
        required int32 display_id = 1;
        required bool has_surface = 2;
        required string package_name = 3;
        required int32 frame_left = 4;
        required int32 frame_top = 5;
        required int32 frame_right = 6;
        required int32 frame_bottom = 7;
        required int32 task_id = 8;
        required int32 stack_id = 9;
    }
    repeated WindowState windows = 1;
    repeated WindowState removed_windows = 2;
}

message ApplicationListUpdateEvent {
    message Application {
        required string name = 1;
        required string package = 2;
        optional Intent launch_intent = 3;
        optional bytes icon = 4;
    }
    repeated Application applications = 1;
    repeated Application removed_applications = 2;
}

message EventSequence {
    optional BootFinishedEvent boot_finished = 1;
    optional WindowStateUpdateEvent window_state_update = 2;
    optional ApplicationListUpdateEvent application_list_update = 3;

    optional string error = 127;
    optional StructuredError structured_error = 128;
}
