import { Type, type Static } from '@eggjs/typebox-validate/typebox';
import { Context } from 'egg';
import { TokenType } from '../../core/entity/Token.ts';
import { AbstractController } from './AbstractController.ts';
declare const TokenOptionsRule: Type.TObject<{
    password: Type.TString;
    readonly: Type.TOptional<Type.TBoolean>;
    automation: Type.TOptional<Type.TBoolean>;
    cidr_whitelist: Type.TOptional<Type.TArray<Type.TString>>;
}>;
type TokenOptions = Static<typeof TokenOptionsRule>;
declare const GranularTokenOptionsRule: Type.TObject<{
    automation: Type.TOptional<Type.TBoolean>;
    readonly: Type.TOptional<Type.TBoolean>;
    cidr_whitelist: Type.TOptional<Type.TArray<Type.TString>>;
    name: Type.TString;
    description: Type.TOptional<Type.TString>;
    allowedScopes: Type.TOptional<Type.TArray<Type.TString>>;
    allowedPackages: Type.TOptional<Type.TArray<Type.TString>>;
    expires: Type.TNumber;
}>;
type GranularTokenOptions = Static<typeof GranularTokenOptionsRule>;
export declare class TokenController extends AbstractController {
    private readonly authAdapter;
    createToken(ctx: Context, tokenOptions: TokenOptions): Promise<{
        token: string;
        key: string;
        cidr_whitelist: string[];
        readonly: boolean;
        automation: boolean;
        created: Date;
        updated: Date;
    }>;
    removeToken(ctx: Context, tokenKey: string): Promise<{
        ok: boolean;
    }>;
    listTokens(ctx: Context): Promise<{
        objects: {
            token: string;
            key: string;
            cidr_whitelist: string[];
            readonly: boolean;
            automation: boolean;
            created: Date;
            lastUsedAt: Date | null;
            updated: Date;
        }[];
        total: number;
        urls: {};
    }>;
    private ensureWebUser;
    createGranularToken(ctx: Context, tokenOptions: GranularTokenOptions): Promise<{
        name: string | undefined;
        token: string;
        key: string;
        cidr_whitelist: string[];
        readonly: boolean;
        automation: boolean;
        allowedPackages: string[] | undefined;
        allowedScopes: string[] | undefined;
        created: Date;
        updated: Date;
    }>;
    listGranularTokens(): Promise<{
        objects: {
            name: string;
            description: string | undefined;
            allowedPackages: string[] | undefined;
            allowedScopes: string[] | undefined;
            lastUsedAt: Date;
            expiredAt: Date;
            token: string;
            key: string;
            cidr_whitelist: string[];
            readonly: boolean;
            created: Date;
            updated: Date;
            type: TokenType | undefined;
        }[];
        total: number;
        urls: {};
    }>;
    removeGranularToken(tokenKey: string): Promise<void>;
}
export {};
