/****************************************************************************/
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
// Copyright (C) 2017-2018 German Aerospace Center (DLR) and others.
// This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v2.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v20.html
// SPDX-License-Identifier: EPL-2.0
/****************************************************************************/

syntax = "proto3";

package hybridsim;

service HybridSimulation {
    rpc simulatedTimeInerval (LeftClosedRightOpenTimeInterval) returns (Empty) {
    }
    rpc transferAgent (Agent) returns (Boolean) {
    }
    rpc receiveTrajectories (Empty) returns (Trajectories) {
    }
    rpc queryRetrievableAgents (Empty) returns (Agents) {
    }
    rpc confirmRetrievedAgents (Agents) returns (Empty) {
    }
    rpc shutdown (Empty) returns (Empty) {
    }
    rpc initScenario (Scenario) returns (Empty) {
    }
    rpc runInfo (RunInfo) returns (Empty) {
    }
    rpc reset (Reset) returns (Empty) {
    }


}


message RunInfo {
    string runInfo0 = 1;
    string runInfo1 = 2;
    string runInfo2 = 3;
}

message Reset {
    int32 iteration = 1;
}

message Scenario {
    repeated Edge edges = 1;

}

message Edge {
    Coordinate c0 = 1;
    Coordinate c1 = 2;
    enum Type {
        OBSTACLE = 0;
        TRANSITION = 1;
        TRANSITION_INTERNAL = 2;
        TRANSITION_HOLDOVER = 3;
    }
    Type type = 3;
    int32 id = 4;
}


message LeftClosedRightOpenTimeInterval {
    double fromTimeIncluding = 1;
    double toTimeExcluding = 2;
}

message Empty {
}

message Boolean {
    bool val = 1;
}

message Agent {
    int32 id = 1;
    Coordinate enterLocation = 2;
    Coordinate leaveLocation = 3;
    repeated Destination dests = 4;
}

message Destination {
    int32 id = 1;
}

message Leg {
    repeated Link link = 15;
}

message Link {
    Coordinate centroid = 1;
    int32 id = 2;
    int32 frTr = 3;
    int32 toTr = 4;
}

message Coordinate {
    double x = 1;
    double y = 2;
}

message Agents {
    repeated Agent agents = 1;
}

message Trajectory {
    int32 id = 1;
    double x = 2;
    double y = 3;
    Destination currentDest = 4;
    double phi = 5;
}

message Trajectories {
    repeated Trajectory trajectories = 1;
}
