syntax = "proto3";

package com.wixpress.vi.localization.translator;

import "com/wixpress/vi/localization/translator/content.proto";
import "wix/api/validations.proto";
import "wix/api/annotations.proto";
import "google/api/annotations.proto";
import "wix/api/entity.proto";

service RegistrationService {
    option (wix.api.service_entity).message = "com.wixpress.vi.localization.translator.ClientConfig";

    // Register to receive notifications when your uploaded content is partially localized as well.
    rpc Register (RegisterRequest) returns (RegisterResponse) {
        option (google.api.http).post = "/api/registration/v1/register/{config.smartling_project_id}";

        option (wix.api.exposure) = INTERNAL;
        option (wix.api.maturity) = ALPHA;

        option (wix.api.required) = "RegisterRequest.config";
        option (wix.api.required) = "RegisterRequest.config.smartling_project_id";
    }

    // Unregister to stop receiving notifications when your uploaded content is partially localized as well.
    rpc Unregister (UnregisterRequest) returns (UnregisterResponse) {
        option (google.api.http).post = "/api/registration/v1/unregister/{config.smartling_project_id}";

        option (wix.api.exposure) = INTERNAL;
        option (wix.api.maturity) = ALPHA;

        option (wix.api.required) = "UnregisterRequest.config";
        option (wix.api.required) = "UnregisterRequest.config.smartling_project_id";
    }

    // Get all registered clients
    rpc GetAll (GetAllRequest) returns (GetAllResponse) {
        option (google.api.http).get = "/api/registration/v1/getAll";

        option (wix.api.exposure) = INTERNAL;
        option (wix.api.maturity) = ALPHA;
    }
}

message RegisterRequest {
    // Configuration that defines a client
    ClientConfig config = 1;
}

message UnregisterRequest {
    // Configuration that defines a client
    ClientConfig config = 1;
}

message GetAllRequest {
}

message RegisterResponse {
}

message UnregisterResponse {
}

message GetAllResponse {
    // List of all the configurations that are registered
    repeated ClientConfig configs = 1;
}