import { Repository } from 'typeorm';
import { Tenant, User, UserTenantMembership } from '../auth/auth.module';
export declare class SaasPlan {
    id: string;
    name: string;
    description: string;
    priceMonthly: number;
    priceYearly: number;
    maxApiCalls: number;
    maxLicenses: number;
    maxEndpoints: number;
    modulesIncluded: string[];
    isActive: boolean;
    createdAt: Date;
    updatedAt: Date;
}
export declare class SaasLicense {
    id: string;
    tenantId: string;
    clientId: string;
    productId: string;
    createdBy: string;
    licenseKey: string;
    licenseName: string;
    description: string;
    startsAt: Date;
    expiresAt: Date;
    maxApiCalls: number;
    maxEndpoints: number;
    contractId: string;
    billingMetric: string;
    unitPrice: number;
    status: string;
    suspendedAt: Date;
    revokedAt: Date;
    revokeReason: string;
    lastUsedAt: Date;
    provisionedTenantId: string;
    createdAt: Date;
    updatedAt: Date;
}
export declare class SaasApiKey {
    id: string;
    licenseId: string;
    tenantId: string;
    name: string;
    keyHash: string;
    keyPrefix: string;
    environment: string;
    allowedIps: string[];
    rateLimitRpm: number;
    status: string;
    revokedAt: Date;
    lastUsedAt: Date;
    lastUsedIp: string;
    license: SaasLicense;
    createdAt: Date;
}
export declare class SaasEndpoint {
    id: string;
    licenseId: string;
    tenantId: string;
    path: string;
    method: string;
    description: string;
    isActive: boolean;
    createdAt: Date;
}
export declare class SaasUsageEvent {
    id: string;
    tenantId: string;
    licenseId: string;
    apiKeyId: string;
    endpoint: string;
    httpMethod: string;
    httpStatus: number;
    responseMs: number;
    payloadBytes: number;
    clientIp: string;
    userAgent: string;
    billingPeriod: string;
    occurredAt: Date;
}
export declare class SaasUsageSummary {
    id: string;
    tenantId: string;
    licenseId: string;
    billingPeriod: string;
    totalCalls: number;
    successCalls: number;
    errorCalls: number;
    avgResponseMs: number;
    totalBytes: number;
    billableUnits: number;
    unitPrice: number;
    amountDue: number;
    billed: boolean;
    chargeId: string;
    closedAt: Date;
    createdAt: Date;
    updatedAt: Date;
}
export declare class CreateLicenseDto {
    clientId: string;
    productId: string;
    licenseName: string;
    description?: string;
    expiresAt?: string;
    maxApiCalls?: number;
    maxEndpoints?: number;
    contractId?: string;
    billingMetric?: string;
    unitPrice?: number;
    companyName: string;
    companyDocument: string;
    companyEmail: string;
    operatorName: string;
    operatorEmail: string;
    operatorPassword: string;
}
export declare class CreateApiKeyDto {
    name: string;
    environment?: string;
    allowedIps?: string[];
    rateLimitRpm?: number;
}
export declare class AddEndpointDto {
    path: string;
    method?: string;
    description?: string;
}
export declare class RevokeReasonDto {
    reason: string;
}
export declare class SaasService {
    private readonly licenseRepo;
    private readonly apiKeyRepo;
    private readonly endpointRepo;
    private readonly usageEventRepo;
    private readonly summaryRepo;
    private readonly tenantRepo;
    private readonly userRepo;
    private readonly membershipRepo;
    private readonly logger;
    constructor(licenseRepo: Repository<SaasLicense>, apiKeyRepo: Repository<SaasApiKey>, endpointRepo: Repository<SaasEndpoint>, usageEventRepo: Repository<SaasUsageEvent>, summaryRepo: Repository<SaasUsageSummary>, tenantRepo: Repository<Tenant>, userRepo: Repository<User>, membershipRepo: Repository<UserTenantMembership>);
    createLicense(tenantId: string, userId: string, dto: CreateLicenseDto): Promise<SaasLicense & {
        provisionedEmail: string;
    }>;
    listLicenses(tenantId: string, status?: string): Promise<SaasLicense[]>;
    findLicense(tenantId: string, id: string): Promise<SaasLicense>;
    suspendLicense(tenantId: string, id: string): Promise<SaasLicense>;
    revokeLicense(tenantId: string, id: string, dto: RevokeReasonDto): Promise<SaasLicense>;
    reactivateLicense(tenantId: string, id: string): Promise<SaasLicense>;
    createApiKey(tenantId: string, licenseId: string, dto: CreateApiKeyDto): Promise<{
        apiKey: SaasApiKey;
        plainKey: string;
    }>;
    listApiKeys(tenantId: string, licenseId: string): Promise<SaasApiKey[]>;
    revokeApiKey(tenantId: string, licenseId: string, keyId: string): Promise<SaasApiKey>;
    validateApiKey(rawKey: string): Promise<{
        apiKey: SaasApiKey;
        license: SaasLicense;
    } | null>;
    addEndpoint(tenantId: string, licenseId: string, dto: AddEndpointDto): Promise<SaasEndpoint>;
    listEndpoints(tenantId: string, licenseId: string): Promise<SaasEndpoint[]>;
    removeEndpoint(tenantId: string, licenseId: string, endpointId: string): Promise<void>;
    recordUsage(params: {
        tenantId: string;
        licenseId: string;
        apiKeyId: string;
        endpoint: string;
        httpMethod: string;
        httpStatus: number;
        responseMs: number;
        payloadBytes: number;
        clientIp: string;
        userAgent: string;
    }): Promise<void>;
    getUsageSummary(tenantId: string, licenseId: string, period?: string): Promise<SaasUsageSummary[]>;
    getLicenseDashboard(tenantId: string, licenseId: string): Promise<{
        license: SaasLicense;
        currentPeriod: string;
        callsThisPeriod: number;
        callsLimit: number;
        usagePercent: number;
        recentEvents: SaasUsageEvent[];
    }>;
    closeBillingPeriod(tenantId: string, licenseId: string, period: string): Promise<SaasUsageSummary>;
}
export declare class SaasLicensesController {
    private readonly saasService;
    constructor(saasService: SaasService);
    create(dto: CreateLicenseDto, req: any): Promise<SaasLicense & {
        provisionedEmail: string;
    }>;
    list(req: any, status?: string): Promise<SaasLicense[]>;
    findOne(id: string, req: any): Promise<SaasLicense>;
    dashboard(id: string, req: any): Promise<{
        license: SaasLicense;
        currentPeriod: string;
        callsThisPeriod: number;
        callsLimit: number;
        usagePercent: number;
        recentEvents: SaasUsageEvent[];
    }>;
    usage(id: string, req: any, period?: string): Promise<SaasUsageSummary[]>;
    suspend(id: string, req: any): Promise<SaasLicense>;
    reactivate(id: string, req: any): Promise<SaasLicense>;
    revoke(id: string, dto: RevokeReasonDto, req: any): Promise<SaasLicense>;
    closePeriod(id: string, period: string, req: any): Promise<SaasUsageSummary>;
}
export declare class SaasApiKeysController {
    private readonly saasService;
    constructor(saasService: SaasService);
    create(licenseId: string, dto: CreateApiKeyDto, req: any): Promise<{
        apiKey: SaasApiKey;
        plainKey: string;
    }>;
    list(licenseId: string, req: any): Promise<SaasApiKey[]>;
    revoke(licenseId: string, keyId: string, req: any): Promise<SaasApiKey>;
}
export declare class SaasEndpointsController {
    private readonly saasService;
    constructor(saasService: SaasService);
    add(licenseId: string, dto: AddEndpointDto, req: any): Promise<SaasEndpoint>;
    list(licenseId: string, req: any): Promise<SaasEndpoint[]>;
    remove(licenseId: string, endpointId: string, req: any): Promise<void>;
}
export declare class SaasModule {
}
