// Copyright 2024 Flower Labs GmbH. All Rights Reserved.
//
// 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";

package flwr.proto;

message DoubleList { repeated double vals = 1; }
message Sint64List { repeated sint64 vals = 1; }
message BoolList { repeated bool vals = 1; }
message StringList { repeated string vals = 1; }
message BytesList { repeated bytes vals = 1; }

message Array {
  string dtype = 1;
  repeated int32 shape = 2;
  string stype = 3;
  bytes data = 4;
}

message MetricsRecordValue {
  oneof value {
    // Single element
    double double = 1;
    sint64 sint64 = 2;

    // List types
    DoubleList double_list = 21;
    Sint64List sint64_list = 22;
  }
}

message ConfigsRecordValue {
  oneof value {
    // Single element
    double double = 1;
    sint64 sint64 = 2;
    bool bool = 3;
    string string = 4;
    bytes bytes = 5;

    // List types
    DoubleList double_list = 21;
    Sint64List sint64_list = 22;
    BoolList bool_list = 23;
    StringList string_list = 24;
    BytesList bytes_list = 25;
  }
}

message ParametersRecord {
  repeated string data_keys = 1;
  repeated Array data_values = 2;
}

message MetricsRecord { map<string, MetricsRecordValue> data = 1; }

message ConfigsRecord { map<string, ConfigsRecordValue> data = 1; }

message RecordSet {
  map<string, ParametersRecord> parameters = 1;
  map<string, MetricsRecord> metrics = 2;
  map<string, ConfigsRecord> configs = 3;
}
