syntax = "proto3";

option java_multiple_files = true;
option java_package = "<%= packageName %>.web.grpc.entity.account";

import "google/protobuf/empty.proto";
import "entity/user.proto";
import "buf/validate/validate.proto";

package entity;

service AccountService {
    rpc RegisterAccount(entity.UserProto) returns (google.protobuf.Empty);

    rpc ActivateAccount(AccountKeyProto) returns (google.protobuf.Empty);

    rpc GetAccount(google.protobuf.Empty) returns (entity.UserProto);

    rpc SaveAccount(entity.UserProto) returns (google.protobuf.Empty);

    rpc ChangePassword(PasswordChangeProto) returns (google.protobuf.Empty);

    rpc RequestPasswordReset(ResetPasswordProto) returns (google.protobuf.Empty);

    rpc FinishPasswordReset(FinishPasswordProto) returns (google.protobuf.Empty);
}

message AccountKeyProto {
    string key = 1;
}

message PasswordChangeProto {
    string current_password = 1;
    string new_password = 2 [(buf.validate.field).string = {
        min_len: 4,
        max_len: 100
    }];
}

message ResetPasswordProto {
    string mail = 1;
}

message FinishPasswordProto {
    string key = 1;
    string new_password = 2 [(buf.validate.field).string = {
        min_len: 4,
        max_len: 100
    }];
}



