syntax = "proto3";

package SceneEdit;

enum StatusCode {
    Success = 0;
    Error = 1;
}

enum Space {
    Local = 0;
    World = 1;
}

message Transform {
    repeated double pos = 1;        // 位置 (3 elements)
    repeated double quat = 2;       // 旋转四元数 (4 elements)
    double scale = 3;               // 等比缩放 (1 elements)
}


message AlohaRequest {
    int32 value = 1;
}
message AlohaResponse {
    StatusCode status_code = 1;
    string error_message = 2;
    int32 value = 3;
}


message AddActorRequest {
    string spawnable_name = 1;      // Actor 使用的 spawnable 名字
    string actor_name = 2;          // Actor Entity 的名字
    string parent_actor_path = 3;   // Parent Actor 的路径
    Transform transform = 4;
    Space space = 5;
}
message AddActorResponse {
    StatusCode status_code = 1;
    string error_message = 2;
}

message AddGroupRequest {
    string actor_name = 2;          // Actor Entity 的名字
    string parent_actor_path = 3;   // Parent Actor 的路径
    Transform transform = 4;
    Space space = 5;
}
message AddGroupResponse {
    StatusCode status_code = 1;
    string error_message = 2;
}


message SetActorTransformRequest {
    string actor_path = 1;
    Transform transform = 2;
    Space space = 3;
}
message SetActorTransformResponse {
    StatusCode status_code = 1;
    string error_message = 2;
}

message GetPendingOperationsRequest {
}
message GetPendingOperationsResponse {
    StatusCode status_code = 1;
    string error_message = 2;
    repeated string operations = 3;
}

message GetPendingActorTransformRequest {
    StatusCode status_code = 1;
    string error_message = 2;
    string actor_path = 3;
    Space space = 4;
}
message GetPendingActorTransformResponse {
    StatusCode status_code = 1;
    string error_message = 2;
    Transform transform = 3;
}


message GetSyncFromMujocoToSceneRequest {
}
message GetSyncFromMujocoToSceneResponse {
    StatusCode status_code = 1;
    string error_message = 2;
    bool value = 3;
}


message SetSyncFromMujocoToSceneRequest {
    bool value = 1;
}
message SetSyncFromMujocoToSceneResponse {
    StatusCode status_code = 1;
    string error_message = 2;
    bool value = 3;
}

message ClearSceneRequest {
}
message ClearSceneResponse {
    StatusCode status_code = 1;
    string error_message = 2;
}

message GetActorAssetsRequest {
}
message GetActorAssetsResponse {
    StatusCode status_code = 1;
    string error_message = 2;
    repeated string actor_asset_names = 3;
}

message GetPendingSelectionChangeRequest {
}
message GetPendingSelectionChangeResponse {
    StatusCode status_code = 1;
    string error_message = 2;
    repeated string actor_paths = 3;
}

message GetPendingAddItemRequest {
}
message GetPendingAddItemResponse {
    StatusCode status_code = 1;
    string error_message = 2;
    Transform transform = 3;
    string actor_name = 4;
}

message SetSelectionRequest {
    repeated string actor_paths = 1;
}
message SetSelectionResponse {
    StatusCode status_code = 1;
    string error_message = 2;
}


message SaveBodyTransformRequest {
}
message SaveBodyTransformResponse {
    StatusCode status_code = 1;
    string error_message = 2;
}

message RestoreBodyTransformRequest {
}
message RestoreBodyTransformResponse {
    StatusCode status_code = 1;
    string error_message = 2;
}

message DeleteActorRequest {
    string actor_path = 1;
}
message DeleteActorResponse {
    StatusCode status_code = 1;
    string error_message = 2;
}

message RenameActorRequest {
    string actor_path = 1;
    string new_name = 2;
}
message RenameActorResponse {
    StatusCode status_code = 1;
    string error_message = 2;
}


message ReParentActorRequest {
    string actor_path = 1;
    string new_parent_path = 2;
}
message ReParentActorResponse {
    StatusCode status_code = 1;
    string error_message = 2;
}

message GetWindowIdRequest {
    
}
message GetWindowIdResponse {
    StatusCode status_code = 1;
    string error_message = 2;
    uint64 window_id = 3;
}

message GetGeneratePosRequest {
    float posX = 1;
    float posY = 2;
}
message GetGeneratePosResponse {
    StatusCode status_code = 1;
    string error_message = 2;
    Transform transform = 3;
}


message GetCacheFolderRequest {
}
message GetCacheFolderResponse {
    StatusCode status_code = 1;
    string error_message = 2;
    string cache_folder = 3;
}


message LoadPackageRequest {
    string file_path = 1;
}
message LoadPackageResponse {
    StatusCode status_code = 1;
    string error_message = 2;
}

message ChangeSimStateRequest {
    bool sim_process_running = 1;
}
message ChangeSimStateResponse {
    StatusCode status_code = 1;
    string error_message = 2;
}

message GetCameraPNGRequest {
    string camera_name = 1;
    string png_path = 2;
    string png_name = 3;
}

message GetCameraPNGResponse {
    StatusCode status_code = 1;
    string error_message = 2;
}

service GrpcService {
    rpc Aloha(AlohaRequest) returns (AlohaResponse);
    
    rpc AddActor(AddActorRequest) returns (AddActorResponse);
    rpc AddGroup(AddGroupRequest) returns (AddGroupResponse);
    rpc SetActorTransform(SetActorTransformRequest) returns (SetActorTransformResponse);

    rpc GetPendingOperations(GetPendingOperationsRequest) returns (GetPendingOperationsResponse);
    rpc GetPendingActorTransform(GetPendingActorTransformRequest) returns (GetPendingActorTransformResponse);

    rpc GetSyncFromMujocoToScene(GetSyncFromMujocoToSceneRequest) returns (GetSyncFromMujocoToSceneResponse);
    rpc SetSyncFromMujocoToScene(SetSyncFromMujocoToSceneRequest) returns (SetSyncFromMujocoToSceneResponse);

    rpc ClearScene(ClearSceneRequest) returns (ClearSceneResponse);
    rpc GetActorAssets(GetActorAssetsRequest) returns (GetActorAssetsResponse);

    rpc GetPendingSelectionChange(GetPendingSelectionChangeRequest) returns (GetPendingSelectionChangeResponse);
    rpc GetPendingAddItem(GetPendingAddItemRequest) returns (GetPendingAddItemResponse);
    rpc SetSelection(SetSelectionRequest) returns (SetSelectionResponse);

    rpc SaveBodyTransform(SaveBodyTransformRequest) returns (SaveBodyTransformResponse);
    rpc RestoreBodyTransform(RestoreBodyTransformRequest) returns (RestoreBodyTransformResponse);

    rpc DeleteActor(DeleteActorRequest) returns (DeleteActorResponse);
    rpc RenameActor(RenameActorRequest) returns (RenameActorResponse);
    rpc ReParentActor(ReParentActorRequest) returns (ReParentActorResponse);

    rpc GetWindowId(GetWindowIdRequest) returns (GetWindowIdResponse);
    rpc GetGeneratePos(GetGeneratePosRequest) returns (GetGeneratePosResponse);

    rpc GetCacheFolder(GetCacheFolderRequest) returns (GetCacheFolderResponse);
    rpc LoadPackage(LoadPackageRequest) returns (LoadPackageResponse);
    rpc ChangeSimState(ChangeSimStateRequest) returns (ChangeSimStateResponse);

    rpc GetCameraPNG(GetCameraPNGRequest) returns (GetCameraPNGResponse);
}
