syntax = "proto3";

package pro;

option go_package = "github.com/canonical/ubuntu-desktop-provision/provd/proto";

import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";

service ProService {
    rpc ProMagicAttach(google.protobuf.Empty) returns (stream ProMagicAttachResponse);
    rpc ProAttach(ProAttachRequest) returns (ProAttachResponse);
    rpc ProStatus(google.protobuf.Empty) returns (google.protobuf.BoolValue);
}

enum ProMagicAttachResponseType {
    USER_CODE = 0;
    REFRESHED_USER_CODE = 1;
    SUCCESS = 2;
    NETWORK_ERROR = 3;
    SUBSCRIPTION_LIMIT_REACHED = 4;
    UNKNOWN_ERROR = 5;
    ALREADY_ATTACHED = 6;
}

message ProAttachRequest {
    string token = 1;
}

message ProAttachResponse {
    enum ProAttachResponseType {
        SUCCESS = 0;
        NETWORK_ERROR = 1;
        UNKNOWN_ERROR = 2;
        ALREADY_ATTACHED = 3;
    }
    ProAttachResponseType type = 1;
}

message ProMagicAttachResponse {
    ProMagicAttachResponseType type = 1;
    optional string userCode = 2;
}
