import type { IRouteConfig } from '@push.rocks/smartproxy';
export type IRouteSecurity = NonNullable<IRouteConfig['security']>;
export type TApiTokenScope = 'routes:read' | 'routes:write' | 'config:read' | 'tokens:read' | 'tokens:manage' | 'profiles:read' | 'profiles:write' | 'targets:read' | 'targets:write';
/**
 * A reusable, named security profile that can be referenced by routes.
 * Stores the full IRouteSecurity shape from SmartProxy.
 */
export interface ISecurityProfile {
    id: string;
    name: string;
    description?: string;
    /** The security configuration — mirrors SmartProxy's IRouteSecurity. */
    security: IRouteSecurity;
    /** IDs of profiles this one extends (resolved top-down, later overrides earlier). */
    extendsProfiles?: string[];
    createdAt: number;
    updatedAt: number;
    createdBy: string;
}
/**
 * A reusable, named network target (host + port) that can be referenced by routes.
 */
export interface INetworkTarget {
    id: string;
    name: string;
    description?: string;
    host: string | string[];
    port: number;
    createdAt: number;
    updatedAt: number;
    createdBy: string;
}
/**
 * Metadata on a stored route tracking where its resolved values came from.
 */
export interface IRouteMetadata {
    /** ID of the SecurityProfileDoc used to resolve this route's security. */
    securityProfileRef?: string;
    /** ID of the NetworkTargetDoc used to resolve this route's targets. */
    networkTargetRef?: string;
    /** Snapshot of the profile name at resolution time, for display. */
    securityProfileName?: string;
    /** Snapshot of the target name at resolution time, for display. */
    networkTargetName?: string;
    /** Timestamp of last reference resolution. */
    lastResolvedAt?: number;
}
/**
 * A merged route combining hardcoded and programmatic sources.
 */
export interface IMergedRoute {
    route: IRouteConfig;
    source: 'hardcoded' | 'programmatic';
    enabled: boolean;
    overridden: boolean;
    storedRouteId?: string;
    createdAt?: number;
    updatedAt?: number;
    metadata?: IRouteMetadata;
}
/**
 * A warning generated during route merge/startup.
 */
export interface IRouteWarning {
    type: 'disabled-hardcoded' | 'disabled-programmatic' | 'orphaned-override';
    routeName: string;
    message: string;
}
/**
 * Public info about an API token (never includes the hash).
 */
export interface IApiTokenInfo {
    id: string;
    name: string;
    scopes: TApiTokenScope[];
    createdAt: number;
    expiresAt: number | null;
    lastUsedAt: number | null;
    enabled: boolean;
}
/**
 * A programmatic route stored in /config-api/routes/{id}.json
 */
export interface IStoredRoute {
    id: string;
    route: IRouteConfig;
    enabled: boolean;
    createdAt: number;
    updatedAt: number;
    createdBy: string;
    metadata?: IRouteMetadata;
}
/**
 * An override for a hardcoded route, stored in /config-api/overrides/{routeName}.json
 */
export interface IRouteOverride {
    routeName: string;
    enabled: boolean;
    updatedAt: number;
    updatedBy: string;
}
/**
 * A stored API token, stored in /config-api/tokens/{id}.json
 */
export interface IStoredApiToken {
    id: string;
    name: string;
    tokenHash: string;
    scopes: TApiTokenScope[];
    createdAt: number;
    expiresAt: number | null;
    lastUsedAt: number | null;
    createdBy: string;
    enabled: boolean;
}
