// @generated by protoc-gen-es v2.13.0 with parameter "target=ts,import_extension=js"
// @generated from file soulfire/login.proto (package soulfire.v1, syntax proto3)
/* eslint-disable */

import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
import { file_soulfire_api_docs } from "./api_docs_pb.js";
import { file_google_api_annotations } from "../google/api/annotations_pb.js";
import { file_google_api_field_behavior } from "../google/api/field_behavior_pb.js";
import type { Message } from "@bufbuild/protobuf";

/**
 * Describes the file soulfire/login.proto.
 */
export const file_soulfire_login: GenFile = /*@__PURE__*/
  fileDesc("ChRzb3VsZmlyZS9sb2dpbi5wcm90bxILc291bGZpcmUudjEiLQoMTG9naW5SZXF1ZXN0Eh0KBWVtYWlsGAEgASgJQg7gQQLS8xgHCgVlbWFpbCKfAwoUTmV4dEF1dGhGbG93UmVzcG9uc2USJgoPYXV0aF9mbG93X3Rva2VuGAEgASgJQg3gQQLS8xgGCgR1dWlkEkEKCmVtYWlsX2NvZGUYAiABKAsyKy5zb3VsZmlyZS52MS5OZXh0QXV0aEZsb3dSZXNwb25zZS5FbWFpbENvZGVIABI8CgdzdWNjZXNzGAMgASgLMikuc291bGZpcmUudjEuTmV4dEF1dGhGbG93UmVzcG9uc2UuU3VjY2Vzc0gAEjwKB2ZhaWx1cmUYBCABKAsyKS5zb3VsZmlyZS52MS5OZXh0QXV0aEZsb3dSZXNwb25zZS5GYWlsdXJlSAAaCwoJRW1haWxDb2RlGh0KB1N1Y2Nlc3MSEgoFdG9rZW4YASABKAlCA+BBAhpsCgdGYWlsdXJlEkUKBnJlYXNvbhgBIAEoDjIwLnNvdWxmaXJlLnYxLk5leHRBdXRoRmxvd1Jlc3BvbnNlLkZhaWx1cmUuUmVhc29uQgPgQQIiGgoGUmVhc29uEhAKDElOVkFMSURfQ09ERRAAQgYKBG5leHQiTQoQRW1haWxDb2RlUmVxdWVzdBImCg9hdXRoX2Zsb3dfdG9rZW4YASABKAlCDeBBAtLzGAYKBHV1aWQSEQoEY29kZRgCIAEoCUID4EECMpgDCgxMb2dpblNlcnZpY2USvQEKBUxvZ2luEhkuc291bGZpcmUudjEuTG9naW5SZXF1ZXN0GiEuc291bGZpcmUudjEuTmV4dEF1dGhGbG93UmVzcG9uc2UidsrzGF4KEFN0YXJ0IGxvZ2luIGZsb3ciDHB1YmxpYy5sb2dpbjo8U3RhcnRzIGFuIGVtYWlsIGxvZ2luIGZsb3cgYW5kIG1heSBzZW5kIGEgdmVyaWZpY2F0aW9uIGNvZGUugtPkkwIOOgEqIgkvdjEvbG9naW4SxwEKCUVtYWlsQ29kZRIdLnNvdWxmaXJlLnYxLkVtYWlsQ29kZVJlcXVlc3QaIS5zb3VsZmlyZS52MS5OZXh0QXV0aEZsb3dSZXNwb25zZSJ4yvMYVQoRVmVyaWZ5IGVtYWlsIGNvZGUiDHB1YmxpYy5sb2dpbjoyQ29tcGxldGVzIHRoZSBsb2dpbiBmbG93IGFuZCBtYXkgaXNzdWUgYW4gQVBJIEpXVC6C0+STAhk6ASoiFC92MS9sb2dpbi9lbWFpbC1jb2RlQiEKHWNvbS5zb3VsZmlyZW1jLmdycGMuZ2VuZXJhdGVkUAFiBnByb3RvMw", [file_soulfire_api_docs, file_google_api_annotations, file_google_api_field_behavior]);

/**
 * Request message for initiating a login flow with an email address.
 *
 * @generated from message soulfire.v1.LoginRequest
 */
export type LoginRequest = Message<"soulfire.v1.LoginRequest"> & {
  /**
   * The email address of the user attempting to log in.
   * If a user with this email exists, a six-digit verification code will be sent to this address.
   * For security reasons, the response is the same whether or not the email is registered,
   * preventing enumeration attacks.
   *
   * @generated from field: string email = 1;
   */
  email: string;
};

/**
 * Describes the message soulfire.v1.LoginRequest.
 * Use `create(LoginRequestSchema)` to create a new message.
 */
export const LoginRequestSchema: GenMessage<LoginRequest> = /*@__PURE__*/
  messageDesc(file_soulfire_login, 0);

/**
 * Response message representing the next step in the authentication flow.
 * This is a polymorphic response that indicates what action should be taken next.
 *
 * @generated from message soulfire.v1.NextAuthFlowResponse
 */
export type NextAuthFlowResponse = Message<"soulfire.v1.NextAuthFlowResponse"> & {
  /**
   * A unique token identifying this authentication flow session.
   * This token must be included in subsequent requests (e.g., EmailCodeRequest) to continue the flow.
   * The token is a UUID string and expires after 15 minutes of inactivity.
   *
   * @generated from field: string auth_flow_token = 1;
   */
  authFlowToken: string;

  /**
   * The next step in the authentication flow. Exactly one of these will be set.
   *
   * @generated from oneof soulfire.v1.NextAuthFlowResponse.next
   */
  next: {
    /**
     * Set when the client should prompt the user to enter the email verification code.
     * This is the response after a successful Login RPC call.
     *
     * @generated from field: soulfire.v1.NextAuthFlowResponse.EmailCode email_code = 2;
     */
    value: NextAuthFlowResponse_EmailCode;
    case: "emailCode";
  } | {
    /**
     * Set when authentication is complete and successful.
     * Contains the JWT token for authenticated API access.
     *
     * @generated from field: soulfire.v1.NextAuthFlowResponse.Success success = 3;
     */
    value: NextAuthFlowResponse_Success;
    case: "success";
  } | {
    /**
     * Set when authentication has failed.
     * Contains the reason for the failure.
     *
     * @generated from field: soulfire.v1.NextAuthFlowResponse.Failure failure = 4;
     */
    value: NextAuthFlowResponse_Failure;
    case: "failure";
  } | { case: undefined; value?: undefined };
};

/**
 * Describes the message soulfire.v1.NextAuthFlowResponse.
 * Use `create(NextAuthFlowResponseSchema)` to create a new message.
 */
export const NextAuthFlowResponseSchema: GenMessage<NextAuthFlowResponse> = /*@__PURE__*/
  messageDesc(file_soulfire_login, 1);

/**
 * Indicates that an email verification code has been sent (if the email was registered).
 * The client should prompt the user to enter the six-digit code from their email.
 * This is an empty message as the presence itself is the signal; no additional data is needed.
 *
 * @generated from message soulfire.v1.NextAuthFlowResponse.EmailCode
 */
export type NextAuthFlowResponse_EmailCode = Message<"soulfire.v1.NextAuthFlowResponse.EmailCode"> & {
};

/**
 * Describes the message soulfire.v1.NextAuthFlowResponse.EmailCode.
 * Use `create(NextAuthFlowResponse_EmailCodeSchema)` to create a new message.
 */
export const NextAuthFlowResponse_EmailCodeSchema: GenMessage<NextAuthFlowResponse_EmailCode> = /*@__PURE__*/
  messageDesc(file_soulfire_login, 1, 0);

/**
 * Indicates successful authentication.
 * The client should store the JWT token and use it for subsequent authenticated requests.
 *
 * @generated from message soulfire.v1.NextAuthFlowResponse.Success
 */
export type NextAuthFlowResponse_Success = Message<"soulfire.v1.NextAuthFlowResponse.Success"> & {
  /**
   * A JWT (JSON Web Token) for authenticating subsequent API requests.
   * This token should be included in the Authorization header for authenticated endpoints.
   * The token is issued with the "api" audience claim.
   *
   * @generated from field: string token = 1;
   */
  token: string;
};

/**
 * Describes the message soulfire.v1.NextAuthFlowResponse.Success.
 * Use `create(NextAuthFlowResponse_SuccessSchema)` to create a new message.
 */
export const NextAuthFlowResponse_SuccessSchema: GenMessage<NextAuthFlowResponse_Success> = /*@__PURE__*/
  messageDesc(file_soulfire_login, 1, 1);

/**
 * Indicates that the authentication flow has failed.
 *
 * @generated from message soulfire.v1.NextAuthFlowResponse.Failure
 */
export type NextAuthFlowResponse_Failure = Message<"soulfire.v1.NextAuthFlowResponse.Failure"> & {
  /**
   * The specific reason for the authentication failure.
   *
   * @generated from field: soulfire.v1.NextAuthFlowResponse.Failure.Reason reason = 1;
   */
  reason: NextAuthFlowResponse_Failure_Reason;
};

/**
 * Describes the message soulfire.v1.NextAuthFlowResponse.Failure.
 * Use `create(NextAuthFlowResponse_FailureSchema)` to create a new message.
 */
export const NextAuthFlowResponse_FailureSchema: GenMessage<NextAuthFlowResponse_Failure> = /*@__PURE__*/
  messageDesc(file_soulfire_login, 1, 2);

/**
 * Enumeration of possible failure reasons.
 *
 * @generated from enum soulfire.v1.NextAuthFlowResponse.Failure.Reason
 */
export enum NextAuthFlowResponse_Failure_Reason {
  /**
   * The provided verification code was incorrect, expired, or the auth flow token was invalid.
   * This is also returned when the auth flow token does not exist (e.g., expired after 15 minutes)
   * to prevent timing attacks that could reveal valid flow tokens.
   *
   * @generated from enum value: INVALID_CODE = 0;
   */
  INVALID_CODE = 0,
}

/**
 * Describes the enum soulfire.v1.NextAuthFlowResponse.Failure.Reason.
 */
export const NextAuthFlowResponse_Failure_ReasonSchema: GenEnum<NextAuthFlowResponse_Failure_Reason> = /*@__PURE__*/
  enumDesc(file_soulfire_login, 1, 2, 0);

/**
 * Request message for verifying an email verification code.
 *
 * @generated from message soulfire.v1.EmailCodeRequest
 */
export type EmailCodeRequest = Message<"soulfire.v1.EmailCodeRequest"> & {
  /**
   * The authentication flow token received from the Login RPC response.
   * This token links the code verification to the original login request.
   * Must be a valid UUID string.
   *
   * @generated from field: string auth_flow_token = 1;
   */
  authFlowToken: string;

  /**
   * The six-digit verification code that was sent to the user's email address.
   * Must exactly match the code that was emailed to the user.
   *
   * @generated from field: string code = 2;
   */
  code: string;
};

/**
 * Describes the message soulfire.v1.EmailCodeRequest.
 * Use `create(EmailCodeRequestSchema)` to create a new message.
 */
export const EmailCodeRequestSchema: GenMessage<EmailCodeRequest> = /*@__PURE__*/
  messageDesc(file_soulfire_login, 2);

/**
 * Service for authenticating users via email-based passwordless login.
 *
 * Authentication Flow:
 * 1. Client calls Login with the user's email address
 * 2. If the email is registered, a six-digit code is sent to that email
 * 3. Client receives an auth_flow_token and EmailCode response
 * 4. User enters the code from their email
 * 5. Client calls EmailCode with the auth_flow_token and the code
 * 6. If valid, client receives a JWT token; if invalid, receives a Failure
 *
 * Security Features:
 * - Rate limited to 20 requests per 10 minutes per origin to prevent brute force attacks
 * - Auth flow tokens expire after 15 minutes
 * - Same response for registered and unregistered emails to prevent email enumeration
 * - Invalid codes return the same error as expired/invalid flow tokens to prevent timing attacks
 *
 * Error Handling:
 * - RESOURCE_EXHAUSTED: Rate limit exceeded (too many login attempts)
 * - UNAUTHENTICATED: No origin header provided (required for rate limiting)
 * - INTERNAL: Unexpected server error during processing
 *
 * @generated from service soulfire.v1.LoginService
 */
export const LoginService: GenService<{
  /**
   * Initiates a login flow for the specified email address.
   *
   * If the email is registered, a six-digit verification code is sent to that address.
   * The response always indicates that an email code step is next, regardless of whether
   * the email exists, to prevent email enumeration attacks.
   *
   * Returns:
   * - NextAuthFlowResponse with email_code set and a new auth_flow_token
   *
   * Errors:
   * - RESOURCE_EXHAUSTED: Too many login attempts from this origin
   * - UNAUTHENTICATED: Missing origin header
   * - INTERNAL: Server error (e.g., database or email sending failure)
   *
   * @generated from rpc soulfire.v1.LoginService.Login
   */
  login: {
    methodKind: "unary";
    input: typeof LoginRequestSchema;
    output: typeof NextAuthFlowResponseSchema;
  },
  /**
   * Verifies an email verification code to complete authentication.
   *
   * The auth_flow_token must match a pending login flow, and the code must match
   * the one that was sent to the user's email. On success, returns a JWT token.
   * On failure, returns a Failure response with INVALID_CODE reason.
   *
   * After successful verification, the auth_flow_token is invalidated and cannot be reused.
   *
   * Returns:
   * - NextAuthFlowResponse with success set (containing JWT token) if code is valid
   * - NextAuthFlowResponse with failure set (INVALID_CODE reason) if code is invalid
   *
   * Errors:
   * - RESOURCE_EXHAUSTED: Too many login attempts from this origin
   * - UNAUTHENTICATED: Missing origin header
   * - INTERNAL: Server error (e.g., JWT generation failure)
   *
   * @generated from rpc soulfire.v1.LoginService.EmailCode
   */
  emailCode: {
    methodKind: "unary";
    input: typeof EmailCodeRequestSchema;
    output: typeof NextAuthFlowResponseSchema;
  },
}> = /*@__PURE__*/
  serviceDesc(file_soulfire_login, 0);
