/**
 * Tenant Management Service
 *
 * Service for managing tenants (organizations) and API keys.
 *
 * @packageDocumentation
 */
import { type Tenant, type ApiKey } from "@vorionsys/contracts/db";
/**
 * Tenant tier configurations
 */
export declare const TENANT_TIERS: Record<string, {
    agentLimit: number;
    apiCallsPerMonth: number;
}>;
export interface CreateTenantOptions {
    slug: string;
    name: string;
    contactEmail: string;
    billingEmail?: string;
    tier?: "free" | "organization" | "enterprise";
    registry?: string;
    metadata?: Record<string, unknown>;
}
export interface CreateApiKeyOptions {
    tenantId: string;
    name: string;
    scopes?: string[];
    rateLimit?: number;
    expiresInDays?: number;
}
export interface ApiKeyWithSecret {
    apiKey: ApiKey;
    secret: string;
}
export declare class TenantService {
    private db;
    constructor();
    /**
     * Create a new tenant
     */
    createTenant(options: CreateTenantOptions): Promise<Tenant>;
    /**
     * Get tenant by ID
     */
    getTenantById(id: string): Promise<Tenant | null>;
    /**
     * Get tenant by slug
     */
    getTenantBySlug(slug: string): Promise<Tenant | null>;
    /**
     * Update tenant
     */
    updateTenant(id: string, updates: Partial<Pick<Tenant, "name" | "contactEmail" | "billingEmail" | "metadata">>): Promise<Tenant | null>;
    /**
     * Upgrade tenant tier
     */
    upgradeTier(id: string, newTier: "organization" | "enterprise"): Promise<Tenant | null>;
    /**
     * Suspend tenant
     */
    suspendTenant(id: string, reason: string): Promise<void>;
    /**
     * Reactivate tenant
     */
    reactivateTenant(id: string): Promise<void>;
    private get ak();
    /**
     * Create a new API key
     */
    createApiKey(options: CreateApiKeyOptions): Promise<ApiKeyWithSecret>;
    /**
     * Validate an API key and return tenant context
     */
    validateApiKey(key: string): Promise<{
        valid: boolean;
        tenantId?: string;
        scopes?: string[];
        error?: string;
    }>;
    /**
     * Revoke an API key
     */
    revokeApiKey(id: string, reason: string): Promise<void>;
    /**
     * List API keys for a tenant
     */
    listApiKeys(tenantId: string): Promise<ApiKey[]>;
    /**
     * Reset rate limits (called by scheduler)
     */
    resetRateLimits(): Promise<number>;
    /**
     * Generate a new API key
     */
    private generateApiKey;
    /**
     * Hash an API key for storage
     */
    private hashApiKey;
}
export declare function createTenantService(): TenantService;
export declare function getTenantService(): TenantService;
//# sourceMappingURL=tenant-service.d.ts.map