/*************************************************************************************
 * Copyright (C) 2012-2018 E.R.P. Consultores y Asociados, C.A.                      *
 * Contributor(s): Yamel Senih ysenih@erpya.com                                      *
 * This program is free software: you can redistribute it and/or modify              *
 * it under the terms of the GNU General Public License as published by              *
 * the Free Software Foundation, either version 2 of the License, or                 *
 * (at your option) any later version.                                               *
 * This program is distributed in the hope that it will be useful,                   *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of                    *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                      *
 * GNU General Public License for more details.                                      *
 * You should have received a copy of the GNU General Public License                 *
 * along with this program. If not, see <https://www.gnu.org/licenses/>.             *
 ************************************************************************************/
syntax = "proto3";

option java_multiple_files = true;
option java_package = "org.spin.backend.grpc.enrollment";
option java_outer_classname = "Enrollment";

package enrollment;

// The greeting service definition.
service Register {
  // Request enroll User
  rpc EnrollUser(EnrollUserRequest) returns (User) {}
  // 
  rpc ResetPassword(ResetPasswordRequest) returns (ResetPasswordResponse) {}
  // 
  rpc ResetPasswordFromToken(ResetPasswordTokenRequest) returns (ResetPasswordResponse) {}
  // 
  rpc ActivateUser(ActivateUserRequest) returns (ActivateUserResponse) {}
}

// Request a Enroll for a user
message EnrollUserRequest {
	string user_name = 1;
	string name = 2;
	string email = 4;
	string client_version = 5;
	string application_type = 6;
	string password = 7;
}

// Request a Password Reset
message ResetPasswordRequest {
	string user_name = 1;
	string email = 2;
	string client_version = 3;
}

// Request a Password Reset
message ResetPasswordTokenRequest {
	string token = 1;
	string password = 2;
	string client_version = 3;
}

// Request a Password Reset
message ActivateUserRequest {
	string token = 1;
	string client_version = 2;
}

// user enrolled
message User {
	string user_name = 1;
	string name = 2;
	string email = 4;
}

// Reset Password Response
message ResetPasswordResponse {
	enum ResponseType {
		OK = 0;
		USER_NOT_FOUND = 1;
		TOKEN_NOT_FOUND = 2;
		ERROR = 3;
	}
	ResponseType response_type = 1;
}

// Reset Password Response
message ActivateUserResponse {
	enum ResponseType {
		OK = 0;
		TOKEN_NOT_FOUND = 2;
		ERROR = 3;
	}
	ResponseType response_type = 1;
}
