// A minimal set of protobuf messages required to auth through login5, with a stored credential.
message StoredCredential {
  required string username = 1;
  required bytes data = 2;
}

message ClientInfo {
  required string client_id = 1;
  required string device_id = 2;
}

message LoginRequest {
    required ClientInfo client_info = 1;
    
    oneof login_method {
        StoredCredential stored_credential = 100;
    }
}

message LoginOk {
    required string access_token = 2;
    optional int32 access_token_expires_in = 4;
}

message LoginResponse {
    oneof response {
        LoginOk ok = 1;
        LoginError error = 2;
    }
}

enum LoginError {
    UNKNOWN_ERROR = 0;
    INVALID_CREDENTIALS = 1;
    BAD_REQUEST = 2;
    UNSUPPORTED_LOGIN_PROTOCOL = 3;
    TIMEOUT = 4;
    UNKNOWN_IDENTIFIER = 5;
    TOO_MANY_ATTEMPTS = 6;
    INVALID_PHONENUMBER = 7;
    TRY_AGAIN_LATER = 8;
}