import { TimebackOrgType, TimebackUserRole } from '@playcademy/types/user';

/**
 * Configuration Type Definitions
 */

type TimebackMode = 'local' | 'remote' | 'disabled';
/**
 * Organization configuration input for sandbox.
 * All fields optional since they can be derived from defaults.
 */
interface TimebackOrganizationInput {
    id?: string;
    name?: string;
    type?: TimebackOrgType;
}
/**
 * Course enrollment overrides.
 * - `'mock'` or omit: Use mock ID
 * - Real string: Use that course ID
 * - `null` or `false`: Exclude from enrollment
 */
type CourseEnrollmentOverrides = Record<string, 'mock' | string | null | false>;
/**
 * Timeback configuration input for sandbox.
 * All fields optional since they can be derived from defaults.
 */
interface TimebackConfig {
    mode: TimebackMode;
    onerosterApiUrl?: string;
    caliperApiUrl?: string;
    clientId?: string;
    clientSecret?: string;
    authUrl?: string;
    courseId?: string;
    timebackId?: string;
    organization?: TimebackOrganizationInput;
    role?: TimebackUserRole;
    courseOverrides?: CourseEnrollmentOverrides;
}
/**
 * Authentication configuration input for sandbox.
 * All fields required.
 */
interface AuthConfig {
    betterAuthSecret: string;
    gameJwtSecret: string;
}
/**
 * Sandbox configuration input for sandbox.
 * All fields required.
 */
interface SandboxConfig {
    embedded: boolean;
    auth: AuthConfig;
    timeback: TimebackConfig;
}

/**
 * Configuration Mutation Functions
 */
declare function setEmbeddedMode(embedded: boolean): void;

/**
 * TimeBack Configuration Helpers
 */

declare function isTimebackEnabled(): boolean;
declare function hasTimebackCredentials(): boolean;
declare function hasTimebackFullConfig(): boolean;
declare function requireTimebackCredentials(): TimebackConfig;
declare function configureTimeback(options: Partial<TimebackConfig>): void;
/**
 * Get the effective Timeback mode for display.
 * Returns null if timeback is not configured, otherwise 'mock', 'remote', or 'local'.
 *
 * Logic:
 * - No timebackId → null (timeback disabled)
 * - timebackId='mock' or no credentials → 'mock'
 * - timebackId=real + credentials → actual mode ('remote' or 'local')
 */
declare function getTimebackDisplayMode(): 'mock' | 'remote' | 'local' | null;

declare const config: SandboxConfig;

export { config, configureTimeback, getTimebackDisplayMode, hasTimebackCredentials, hasTimebackFullConfig, isTimebackEnabled, requireTimebackCredentials, setEmbeddedMode };
export type { AuthConfig, CourseEnrollmentOverrides, SandboxConfig, TimebackConfig, TimebackMode };
