//
// Aspia Project
// Copyright (C) 2016-2024 Dmitry Chapyshev <dmitry@aspia.ru>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
// WARNING! For internal use only, on the host side. Messages in this file are not intended for
// transmission over the network.
//

syntax = "proto3";

option optimize_for = LITE_RUNTIME;

import "desktop.proto";
import "desktop_extensions.proto";

package proto.internal;

message DesktopFrame
{
    uint32 capturer_type     = 1;
    int32 shared_buffer_id   = 2;
    int32 width              = 3;
    int32 height             = 4;
    repeated Rect dirty_rect = 5;
}

message MouseCursor
{
    int32 width     = 1;
    int32 height    = 2;
    int32 hotspot_x = 3;
    int32 hotspot_y = 4;
    int32 dpi_x     = 5;
    int32 dpi_y     = 6;
    bytes data      = 7;
}

message SharedBuffer
{
    enum Type
    {
        CREATE  = 0;
        RELEASE = 1;
    }

    Type type = 1;
    int32 shared_buffer_id = 2;
}

message ScreenCaptured
{
    VideoErrorCode error_code = 1;
    DesktopFrame frame        = 2;
    MouseCursor mouse_cursor  = 3;
}

message NextScreenCapture
{
    int64 update_interval = 1;
}

message SelectSource
{
    Screen screen = 1;
}

message Configure
{
    bool disable_font_smoothing = 1;
    bool disable_wallpaper      = 2;
    bool disable_effects        = 3;
    bool block_input            = 4;
    bool lock_at_disconnect     = 5;
    bool clear_clipboard        = 6;
    bool cursor_position        = 7;
}

message DesktopControl
{
    enum Action
    {
        UNKNOWN       = 0;
        DISABLE       = 1;
        ENABLE        = 2;
        LOGOFF        = 3;
        LOCK          = 4;
    }

    Action action = 1;
}

message ServiceToDesktop
{
    DesktopControl control                = 1;
    Configure configure                   = 2;
    SelectSource select_source            = 3;
    NextScreenCapture next_screen_capture = 4;
    KeyEvent key_event                    = 5;
    TextEvent text_event                  = 6;
    MouseEvent mouse_event                = 7;
    TouchEvent touch_event                = 8;
    ClipboardEvent clipboard_event        = 9;
}

message DesktopToService
{
    ScreenList screen_list         = 1;
    SharedBuffer shared_buffer     = 2;
    ScreenCaptured screen_captured = 3;
    AudioPacket audio_packet       = 4;
    ClipboardEvent clipboard_event = 5;
    CursorPosition cursor_position = 6;
    ScreenType screen_type         = 7;
}
