syntax = "proto3";

package com.wixpress.authorization.invite.service;

import "wix/api/annotations.proto";
import "wix/api/validations.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
import "AccountInvite.proto";
import "wix/api/entity.proto";

message CreateInviteRequest {
    repeated string policies = 1;
    string given_by_id = 2 [deprecated = true];
    string given_by_account_id = 3 [(wix.api.format) = GUID];
    string invited_to_account_id = 4 [(wix.api.format) = GUID];
    string dest_email = 5 [(wix.api.format) = EMAIL, (.wix.api.pii) = true];
    repeated InviteResourceAssignment assignments = 6;
    google.protobuf.StringValue brand_domain = 7;
    google.protobuf.StringValue invite_purpose = 8;
}

message ResetInviteRequest {
    string invite_id = 1 [(wix.api.format) = GUID];
}

message AcceptInviteRequest {
    string invite_id = 1 [(wix.api.format) = GUID];
}

message ChangeInvitePoliciesRequest {
    string invite_id = 1 [(wix.api.format) = GUID];
    repeated string policies = 2;
}

message DeleteInviteRequest {
    string invite_id = 1 [(wix.api.format) = GUID];
}

message GetInviteRequest {
    string invite_id = 1 [(wix.api.format) = GUID];
}

message GetInvitesByAccountRequest {
    string account_id = 1 [(wix.api.format) = GUID];
}

message CreateInviteResponse {
    InviteData invite = 1;
}

message ResetInviteResponse {
    InviteData invite = 1;
}

message UpdateInviteAssignmentsRequest {
    string invite_id = 1 [(wix.api.format) = GUID];
    repeated InviteResourceAssignment assignments = 2;
}

message AcceptInviteResponse {
    InviteData invite = 1;
}

message GetInviteResponse {
    InviteData invite = 1;
}

message GetInvitesByAccountResponse {
    repeated InviteData invites = 1;
}

message EmptyResponse {
}

service AccountInviteService {
    option (wix.api.service_entity).message = "com.wixpress.authorization.invite.service.InviteData";
    rpc createNewInvite (CreateInviteRequest) returns (CreateInviteResponse);
    rpc resetInvite (ResetInviteRequest) returns (ResetInviteResponse);
    rpc acceptInvite (AcceptInviteRequest) returns (AcceptInviteResponse);
    rpc changeInvitePolicies (ChangeInvitePoliciesRequest) returns (EmptyResponse) {
        option deprecated = true;
    };
    rpc deleteInvite (DeleteInviteRequest) returns (EmptyResponse);
    rpc updateInviteAssignments (UpdateInviteAssignmentsRequest) returns (EmptyResponse);
    rpc getInvite (GetInviteRequest) returns (GetInviteResponse);
    rpc getInvitesByAccount (GetInvitesByAccountRequest) returns (GetInvitesByAccountResponse);
}
