/*
 * Copyright 2020-2021 Exactpro (Exactpro Systems Limited)
 *
 * 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 = "proto3";

option java_multiple_files = false;
option java_package = "com.exactpro.th2.act.grpc.hand.rhactions";
option java_outer_classname = "RhWinActionsMessages";

import "google/protobuf/wrappers.proto";

message WinLocator {
  string locator = 1;
  string matcher = 2;
  google.protobuf.Int32Value matcherIndex = 3;
}

message BaseWinParams {
  string id = 1;
  string execute = 2;
  bool fromRoot = 3;
  bool experimentalDriver = 4;
}

message WinOpen {
  string workDir = 4;
  string appFile = 5;
  string appArgs = 6;
  BaseWinParams baseParams = 7;
}

message WinClick {
  enum Button {
    LEFT = 0;
    RIGHT = 1;
    MIDDLE = 2;
    DOUBLE = 3;
  }
  enum AttachedBorder {
    NONE = 0;
    LEFT_TOP = 1;
    LEFT_BOTTOM = 2;
    RIGHT_TOP = 3;
    RIGHT_BOTTOM = 4;
  }
  repeated WinLocator locators = 1;
  Button button = 4;
  string xOffset = 5;
  string yOffset = 6;
  BaseWinParams baseParams = 8;
  string modifiers = 9;
}

message WinSendText {
  repeated WinLocator locators = 1;
  string text = 4;
  string clearBefore = 5;
  string isDirectText = 6;
  BaseWinParams baseParams = 7;
}

message WinGetActiveWindow {
  string windowName = 4;
  string accessibilityId = 5;
  int32 maxTimeout = 6;
  BaseWinParams baseParams = 7;
}

message MaximizeMainWindow {
  BaseWinParams baseParams = 4;
}

message WinGetElementAttribute {
  repeated WinLocator locators = 1;
  string attributeName = 4;
  BaseWinParams baseParams = 5;
}

message WinWait {
  uint32 millis = 4;
  BaseWinParams baseParams = 5;
}

message WinToggleCheckBox {
  repeated WinLocator locators = 1;
  string expectedState = 4;
  BaseWinParams baseParams = 5;
}

message WinCheckElement {
  repeated WinLocator locators = 1;
  BaseWinParams baseParams = 4;
  bool saveElement = 5;
}

message WinGetWindow {
  string windowName = 4;
  string accessibilityId = 5;
  BaseWinParams baseParams = 6;
}

message WinSearchElement {
  repeated WinLocator locators = 1;
  BaseWinParams baseParams = 4;
  bool multipleElements = 5;
}

message WinWaitForAttribute {
  repeated WinLocator locators = 1;
  string attributeName = 4;
  string expectedValue = 5;
  string maxTimeout = 6;
  string checkInterval = 7;
  BaseWinParams baseParams = 9;
}

message WinScrollUsingText {
  repeated WinLocator locators = 1;
  string textToSend = 4;
  string maxIterations = 5;
  repeated WinLocator textLocators = 6;
  BaseWinParams baseParams = 7;
}

message WinGetDataFromClipboard {
  BaseWinParams baseParams = 4;
}

message WinTableClick {
  option deprecated = true;
  repeated WinLocator locators = 1;
  string searchParams = 4;
  string targetColumn = 5;
  string columnIndex = 6;
  BaseWinParams baseParams = 7;
}

message WinTableSearch {
  repeated WinLocator locators = 1;
  string searchParams = 4;
  string targetColumn = 5;
  string columnIndex = 6;
  string firstRowIndex = 7;
  string rowNameFormat = 8;
  string rowElementNameFormat = 9;
  string rowElementValueFormat = 10;
  string saveResult = 11;
  BaseWinParams baseParams = 12;
}

message WinWaitForElement {
  repeated WinLocator locators = 1;
  string timeout = 4;
  BaseWinParams baseParams = 6;
}

message WinGetScreenshot {
  repeated WinLocator locators = 1;
  BaseWinParams baseParams = 4;
}

message WinRestartDriver {
  BaseWinParams baseParams = 1;
}

message WinGetElementColor {
  repeated WinLocator locators = 1;
  string xOffset = 4;
  string yOffset = 5;
  BaseWinParams baseParams = 6;
}

message WinDragAndDrop {
  repeated WinLocator fromLocators = 1;
  repeated WinLocator toLocators = 2;
  string fromOffsetX = 6;
  string fromOffsetY = 7;
  string toOffsetX = 8;
  string toOffsetY = 9;
  BaseWinParams baseParams = 10;
}

message WinScrollToElement {
  enum ScrollType {
    CLICK = 0;
    TEXT = 1;
  }

  repeated WinLocator elementLocators = 1;
  repeated WinLocator actionLocators = 2;
  bool isElementInTree = 5;
  bool isElementShouldBeDisplayed = 6;
  ScrollType scrollType = 7;
  int32 maxIterations = 8;
  string clickOffsetX = 9;
  string clickOffsetY = 10;
  string textToSend = 11;
  BaseWinParams baseParams = 12;
}

message WinColorsCollector {
  BaseWinParams baseParams = 1;
  string startXOffset = 2;
  string startYOffset = 3;
  string endXOffset = 4;
  string endYOffset = 5;
}