/*
 * Copyright 2018, CS Systemes d'Information, http://www.c-s.fr
 *
 * This file is part of EODAG project
 *     https://www.github.com/CS-SI/EODAG
 *
 * 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";

import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";

package eodag;

service EOProductType {
    rpc ListProductTypes (google.protobuf.Empty) returns (stream EOProductTypeSchema) {};
    rpc SearchProductType (EOProductTypeSearchRequest) returns (stream EOProductTypeSchema) {};
}

service EOProduct {
    rpc SearchProduct (EOProductSearchRequest) returns (stream EOProductInfo) {};
    rpc DownloadProduct (EOProductDownloadRequest) returns (stream NetCDFBuffer) {};
}

message EOProductTypeMetadataSchema {
    string key = 1;
    string value_type = 2;
}

message EOProductTypeSchema {
    string id = 1;
    repeated EOProductTypeMetadataSchema meta = 2;
    string description = 3;
}

message EOProductTypeSearchRequest {
    string query = 1;
}

message EOProductSearchRequest {
    string product_type = 1;
    string footprint = 2;
    google.protobuf.Timestamp start = 3;
    google.protobuf.Timestamp end = 4;
    string metadata_filter = 5;
}

message Metadata {
    string key = 1;
    google.protobuf.Any value = 2;
}

message EOProductInfo {
    string id = 1;
    Metadata metadata = 2;
}

message EOProductDownloadRequest {
    string product_id = 2;
}

message NetCDFBuffer {
    bytes content = 1;
}