/ src / models / authentication-params.ts
authentication-params.ts
 1  import type { AccountKind } from "./account-kind";
 2  
 3  /**
 4   * Base interface for authentication parameters
 5   */
 6  export interface BaseAuthenticationParams {
 7    /** URL of the PRONOTE instance */
 8    url: string;
 9    /** Account type (student, parent, etc.) */
10    kind: AccountKind;
11    /** Username for authentication */
12    username: string;
13    /** Device UUID for identification */
14    deviceUUID: string;
15    /** Navigator identifier (optional) */
16    navigatorIdentifier?: string;
17  }
18  
19  /**
20   * Parameters for password-based authentication
21   */
22  export interface PasswordAuthenticationParams extends BaseAuthenticationParams {
23    /** Password for authentication */
24    password: string;
25    /** Token should not be present */
26    token?: never;
27  }
28  
29  /**
30   * Parameters for token-based authentication
31   */
32  export interface TokenAuthenticationParams extends BaseAuthenticationParams {
33    /** Token for authentication */
34    token: string;
35    /** Password should not be present */
36    password?: never;
37  }
38  
39  /**
40   * Combined type for all authentication methods
41   */
42  export type AuthenticationParams = PasswordAuthenticationParams | TokenAuthenticationParams;