// This file is part of arduino-cli.
//
// Copyright 2020 ARDUINO SA (http://www.arduino.cc/)
//
// This software is released under the GNU General Public License version 3,
// which covers the main part of arduino-cli.
// The terms of this license can be found at:
// https://www.gnu.org/licenses/gpl-3.0.en.html
//
// You can be released from the requirements of the above licenses by purchasing
// a commercial license. Buying such a license is mandatory if you want to
// modify or otherwise use the software for commercial activities involving the
// Arduino software without disclosing the source code of your own applications.
// To purchase a commercial license, send an email to license@arduino.cc.

syntax = "proto3";

package cc.arduino.cli.commands;

option go_package = "github.com/arduino/arduino-cli/rpc/commands";

import "commands/common.proto";

message PlatformInstallReq {
	// Arduino Core Service instance from the `Init` response.
    Instance instance = 1;
	// Vendor name of the platform (e.g., `arduino`).
	string platform_package  = 2;
	// Architecture name of the platform (e.g., `avr`).
	string architecture = 3;
	// Platform version to install.
	string version = 4;
	// Set to true to not run (eventual) post install scripts for trusted platforms
	bool skipPostInstall = 5;
}

message PlatformInstallResp {
	// Progress of the downloads of the platform and tool files.
	DownloadProgress progress = 1;
	// Description of the current stage of the installation.
	TaskProgress task_progress = 2;
}

message PlatformDownloadReq {
	// Arduino Core Service instance from the `Init` response.
    Instance instance = 1;
	string platform_package  = 2;
	// Architecture name of the platform (e.g., `avr`).
	string architecture = 3;
	// Platform version to download.
	string version = 4;
}

message PlatformDownloadResp {
	// Progress of the downloads of platform and tool files.
	DownloadProgress progress = 1;
}

message PlatformUninstallReq {
	// Arduino Core Service instance from the `Init` response.
    Instance instance = 1;
	// Vendor name of the platform (e.g., `arduino`).
	string platform_package  = 2;
	// Architecture name of the platform (e.g., `avr`).
	string architecture = 3;
}

message PlatformUninstallResp {
	// Description of the current stage of the uninstall.
	TaskProgress task_progress = 1;
}

message PlatformUpgradeReq {
	// Arduino Core Service instance from the `Init` response.
    Instance instance = 1;
	// Vendor name of the platform (e.g., `arduino`).
	string platform_package  = 2;
	// Architecture name of the platform (e.g., `avr`).
	string architecture = 3;
	// Set to true to not run (eventual) post install scripts for trusted platforms
	bool skipPostInstall = 4;
}

message PlatformUpgradeResp {
	// Progress of the downloads of the platform and tool files.
	DownloadProgress progress = 1;
	// Description of the current stage of the upgrade.
	TaskProgress task_progress = 2;
}

message PlatformSearchReq {
	// Arduino Core Service instance from the `Init` response.
	Instance instance = 1;
	// Keywords for the search.
	string search_args = 2;
	// Whether to show all available versions. `false` causes only the newest
	// versions of the cores to be listed in the search results.
	bool all_versions = 3;
}

message PlatformSearchResp {
	// Results of the search.
	repeated Platform search_output = 1;
}

message PlatformListReq {
	// Arduino Core Service instance from the `Init` response.
	Instance instance = 1;
	// Set to true to only list platforms which have a newer version available
	// than the one currently installed.
	bool updatable_only = 2;
}

message PlatformListResp {
	// The installed platforms.
	repeated Platform installed_platform = 1;
}

message Platform {
	// Platform ID (e.g., `arduino:avr`).
	string ID = 1;
	// Version of the platform.
	string Installed = 2;
	// Newest available version of the platform.
	string Latest = 3;
	// Name used to identify the platform to humans (e.g., "Arduino AVR Boards").
	string Name = 4;
	// Maintainer of the platform's package.
	string Maintainer = 5;
	// A URL provided by the author of the platform's package, intended to point
	// to their website.
	string Website = 6;
	// Email of the maintainer of the platform's package.
	string Email = 7;
	// List of boards provided by the platform. If the platform is installed,
	// this is the boards listed in the platform's boards.txt. If the platform is
	// not installed, this is an arbitrary list of board names provided by the
	// platform author for display and may not match boards.txt.
	repeated Board Boards = 8;
}

message Board {
	// Name used to identify the board to humans.
	string name = 1;
	// Fully qualified board name used to identify the board to machines. The FQBN
	// is only available for installed boards.
	string fqbn = 2;
}