import type { App } from "./app.js";
import { JSONRaw } from "../tools/types/json_raw.js";
export declare const ParamsTableName = "_params";
export declare const ParamsKeySettings = "settings";
export type TrustedProxyConfig = {
    headers: string[];
    useLeftmostIP: boolean;
};
export type MetaConfig = {
    accentColor: string;
    appName: string;
    appURL: string;
    hideControls: boolean;
    senderName: string;
    senderAddress: string;
};
export type SMTPConfig = {
    enabled: boolean;
    host: string;
    port: number;
    username: string;
    password: string;
    tls: boolean;
    authMethod: string;
    localName: string;
};
export type S3Config = {
    enabled: boolean;
    bucket: string;
    region: string;
    endpoint: string;
    accessKey: string;
    secret: string;
    forcePathStyle: boolean;
};
export type BatchConfig = {
    enabled: boolean;
    maxRequests: number;
    timeout: number;
    maxBodySize: number;
};
export type BackupsConfig = {
    cron: string;
    cronMaxKeep: number;
    s3: S3Config;
};
export type LogsConfig = {
    maxDays: number;
    minLevel: number;
    logIP: boolean;
    logAuthId: boolean;
};
export declare const RateLimitRuleAudienceAll = "";
export declare const RateLimitRuleAudienceGuest = "@guest";
export declare const RateLimitRuleAudienceAuth = "@auth";
export type RateLimitRule = {
    label: string;
    audience?: string;
    duration: number;
    maxRequests: number;
};
export declare class RateLimitsConfig {
    rules: RateLimitRule[];
    excludedIPs: string[];
    enabled: boolean;
    constructor();
    FindRateLimitRule(searchLabels: string[], ...optOnlyAudience: string[]): [RateLimitRule | null, boolean];
    findRateLimitRule(searchLabels: string[], ...optOnlyAudience: string[]): [RateLimitRule | null, boolean];
    Validate(): Error | null;
}
type SettingsSnapshot = {
    superuserIPs: string[];
    smtp: SMTPConfig;
    backups: BackupsConfig;
    s3: S3Config;
    meta: MetaConfig;
    rateLimits: {
        rules: RateLimitRule[];
        excludedIPs: string[];
        enabled: boolean;
    };
    trustedProxy: TrustedProxyConfig;
    batch: BatchConfig;
    logs: LogsConfig;
};
type SettingsSnapshotJSON = Omit<SettingsSnapshot, "smtp" | "s3" | "backups"> & {
    smtp: Omit<SMTPConfig, "password">;
    s3: Omit<S3Config, "secret">;
    backups: Omit<BackupsConfig, "s3"> & {
        s3: Omit<S3Config, "secret">;
    };
};
export declare class Settings {
    #private;
    superuserIPs: string[];
    trustedProxy: TrustedProxyConfig;
    meta: MetaConfig;
    smtp: SMTPConfig;
    s3: S3Config;
    backups: BackupsConfig;
    logs: LogsConfig;
    rateLimits: RateLimitsConfig;
    batch: BatchConfig;
    constructor();
    TableName(): string;
    PK(): string;
    LastSavedPK(): string;
    isNew(): boolean;
    IsNew(): boolean;
    MarkAsNew(): void;
    MarkAsNotNew(): void;
    PostScan(): Error | null;
    Clone(): Settings;
    Merge(other: Settings): Error | null;
    toRaw(): SettingsSnapshot;
    toJSON(): SettingsSnapshotJSON;
    loadFromJSON(value: unknown): void;
    PostValidate(_ctx: unknown, _app: unknown): Error | null;
    loadParam(app: App, param: {
        Value: JSONRaw;
    }): Error | null;
}
export declare function validateMetaConfig(meta: MetaConfig): Error | null;
export declare function validateLogsConfig(logs: LogsConfig): Error | null;
export declare function validateSMTPConfig(smtp: SMTPConfig): Error | null;
export declare function validateS3Config(s3: S3Config): Error | null;
export declare function validateBackupsConfig(backups: BackupsConfig): Error | null;
export declare function validateBatchConfig(batch: BatchConfig): Error | null;
export declare function validateRateLimitsConfig(rateLimits: RateLimitsConfig): Error | null;
export declare function validateRateLimitRuleConfig(rule: RateLimitRule): Error | null;
export declare function rateLimitRuleDurationTime(rule: RateLimitRule): number;
export declare function rateLimitRuleString(rule: RateLimitRule): string;
export {};
