import type { Mailer, Message } from "../tools/mailer/mailer.js";
import type { ApiError } from "../tools/router/api_error.js";
import type { Router } from "../tools/router/router.js";
import type { SearchResult } from "../tools/search/types.js";
import type { Client as RealtimeClient } from "../tools/subscriptions/client.js";
import type { Message as RealtimeMessage } from "../tools/subscriptions/message.js";
import type { App } from "./app.js";
import type { Model as DbModel } from "./db_model.js";
import type { RequestEvent } from "./event_request.js";
import type { RequestInfo } from "./event_request.js";
import type { FileField } from "./field_file.js";
import type { Record as RecordModel } from "./record_model.js";
import type { Settings } from "./settings_model.js";
import { Event } from "../tools/hook/event.js";
import { Collection } from "./collection_model.js";
export type HookTagger = {
    HookTags(): string[];
};
type Model = DbModel;
export declare class BootstrapEvent extends Event {
    App: App;
    constructor(app: App);
}
export declare class TerminateEvent extends Event {
    App: App;
    IsRestart: boolean;
    constructor(app: App, isRestart?: boolean);
}
export declare class BackupEvent extends Event {
    App: App;
    Context: unknown;
    Name: string;
    Exclude: string[];
    constructor(app: App, ctx: unknown, name: string, exclude: string[]);
}
export type ServeInstallerFunc = (app: App, systemSuperuser: RecordModel, baseURL: string) => Error | null | Promise<Error | null>;
export type UIExtension = {
    Name: string;
    FS: string | {
        root: string;
    };
};
export declare class ServeEvent extends Event {
    App: App;
    Router: Router<RequestEvent>;
    Server: ReturnType<typeof Bun.serve> | null;
    CertManager: unknown;
    Listener: unknown;
    InstallerFunc: ServeInstallerFunc | null;
    UIExtensions: UIExtension[];
    constructor(app: App, router: Router<RequestEvent>);
    get app(): App;
    set app(app: App);
    get router(): Router<RequestEvent>;
    set router(router: Router<RequestEvent>);
    get server(): ReturnType<typeof Bun.serve> | null;
    set server(server: ReturnType<typeof Bun.serve> | null);
    get certManager(): unknown;
    set certManager(certManager: unknown);
    get listener(): unknown;
    set listener(listener: unknown);
    get installerFunc(): ServeInstallerFunc | null;
    set installerFunc(installerFunc: ServeInstallerFunc | null);
    get uiExtensions(): UIExtension[];
    set uiExtensions(uiExtensions: UIExtension[]);
}
export declare class SettingsReloadEvent extends Event {
    App: App;
    constructor(app: App);
}
export declare class SettingsListRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Settings: Settings;
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, settings: Settings);
}
export declare class SettingsUpdateRequestEvent extends Event {
    RequestEvent: RequestEvent;
    OldSettings: Settings;
    NewSettings: Settings;
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, oldSettings: Settings, newSettings: Settings);
}
export declare class MailerEvent extends Event {
    App: App;
    Mailer: Mailer;
    Message: Message;
    constructor(app: App, mailer: Mailer, message: Message);
}
export declare class MailerRecordEvent extends Event {
    #private;
    App: App;
    Mailer: Mailer;
    Message: Message;
    Record: RecordModel | null;
    Meta: Record<string, unknown> | null;
    constructor(app: App, mailer: Mailer, message: Message, record: RecordModel | null, meta: Record<string, unknown> | null);
    Tags(): string[];
}
export declare const ModelEventTypeCreate = "create";
export declare const ModelEventTypeUpdate = "update";
export declare const ModelEventTypeDelete = "delete";
export declare const ModelEventTypeValidate = "validate";
export declare class ModelEvent extends Event {
    #private;
    App: App;
    Context: unknown;
    Type: string;
    Model: Model | null;
    AllowAsync: boolean;
    constructor(app: App, model: Model | null, type: string, context?: unknown);
    Tags(): string[];
}
export declare class ModelErrorEvent extends Event {
    Error: Error;
    ModelEvent: ModelEvent;
    constructor(modelEvent: ModelEvent, error: Error);
    get App(): App;
    set App(app: App);
    get Context(): unknown;
    set Context(context: unknown);
    get Type(): string;
    set Type(type: string);
    get Model(): Model | null;
    set Model(model: Model | null);
    Tags(): string[];
}
export declare class RecordEvent extends Event {
    #private;
    App: App;
    Context: unknown;
    Type: string;
    Record: RecordModel | null;
    AllowAsync: boolean;
    constructor(app: App, record: RecordModel | null, type: string, context?: unknown);
    Tags(): string[];
}
export declare class RecordErrorEvent extends Event {
    Error: Error;
    RecordEvent: RecordEvent;
    constructor(recordEvent: RecordEvent, error: Error);
    get App(): App;
    set App(app: App);
    get Context(): unknown;
    set Context(context: unknown);
    get Type(): string;
    set Type(type: string);
    get Record(): RecordModel | null;
    set Record(record: RecordModel | null);
    Tags(): string[];
}
export declare class CollectionEvent extends Event {
    #private;
    App: App;
    Context: unknown;
    Type: string;
    Collection: Collection | null;
    constructor(app: App, collection: Collection | null, type: string, context?: unknown);
    Tags(): string[];
}
export declare class CollectionErrorEvent extends Event {
    Error: Error;
    CollectionEvent: CollectionEvent;
    constructor(collectionEvent: CollectionEvent, error: Error);
    get App(): App;
    set App(app: App);
    get Context(): unknown;
    set Context(context: unknown);
    get Type(): string;
    set Type(type: string);
    get Collection(): Collection | null;
    set Collection(collection: Collection | null);
    Tags(): string[];
}
export declare function syncModelEventWithRecordEvent(modelEvent: ModelEvent, recordEvent: RecordEvent): void;
export declare function syncRecordEventWithModelEvent(recordEvent: RecordEvent, modelEvent: ModelEvent): void;
export declare function newRecordEventFromModelEvent(modelEvent: ModelEvent): {
    event: RecordEvent | null;
    ok: boolean;
};
export declare function newRecordErrorEventFromModelErrorEvent(modelErrorEvent: ModelErrorEvent): {
    event: RecordErrorEvent | null;
    ok: boolean;
};
export declare function syncModelErrorEventWithRecordErrorEvent(modelErrorEvent: ModelErrorEvent, recordErrorEvent: RecordErrorEvent): void;
export declare function syncRecordErrorEventWithModelErrorEvent(recordErrorEvent: RecordErrorEvent, modelErrorEvent: ModelErrorEvent): void;
export declare function syncModelEventWithCollectionEvent(modelEvent: ModelEvent, collectionEvent: CollectionEvent): void;
export declare function syncCollectionEventWithModelEvent(collectionEvent: CollectionEvent, modelEvent: ModelEvent): void;
export declare function newCollectionEventFromModelEvent(modelEvent: ModelEvent): {
    event: CollectionEvent | null;
    ok: boolean;
};
export declare function newCollectionErrorEventFromModelErrorEvent(modelErrorEvent: ModelErrorEvent): {
    event: CollectionErrorEvent | null;
    ok: boolean;
};
export declare function syncModelErrorEventWithCollectionErrorEvent(modelErrorEvent: ModelErrorEvent, collectionErrorEvent: CollectionErrorEvent): void;
export declare function syncCollectionErrorEventWithModelErrorEvent(collectionErrorEvent: CollectionErrorEvent, modelErrorEvent: ModelErrorEvent): void;
export declare class FileTokenRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Record: RecordModel | null;
    Token: string;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, record: RecordModel | null);
}
export declare class FileDownloadRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    Record: RecordModel;
    FileField: FileField;
    ServedPath: string;
    ServedName: string;
    ThumbError: Error | null;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collection: Collection, record: RecordModel, fileField: FileField, servedPath: string, servedName: string);
}
export declare function newBaseCollectionEventData(collection: Collection | null): {
    Collection: Collection | null;
    Tags: () => string[];
};
export declare class CollectionsListRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collections: Collection[];
    Result: SearchResult<unknown> | null;
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collections: Collection[], result: SearchResult<unknown> | null);
}
export declare class CollectionsImportRequestEvent extends Event {
    RequestEvent: RequestEvent;
    CollectionsData: Array<Record<string, unknown>>;
    DeleteMissing: boolean;
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collectionsData: Array<Record<string, unknown>>, deleteMissing: boolean);
}
export declare class CollectionRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collection: Collection);
}
export declare class RealtimeConnectRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Client: RealtimeClient | null;
    IdleTimeout: number;
    MaxTimeout: number;
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent);
}
export declare class RealtimeMessageEvent extends Event {
    RequestEvent: RequestEvent;
    Client: RealtimeClient | null;
    Message: RealtimeMessage | null;
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent);
}
export declare class RealtimeSubscribeRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Client: RealtimeClient | null;
    Subscriptions: string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent);
}
export declare class RecordsListRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    Records: RecordModel[];
    Result: SearchResult<RecordModel> | null;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    BadRequestError(message: string, errData?: unknown): ApiError;
    constructor(requestEvent: RequestEvent, collection: Collection);
}
export declare class RecordRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    Record: RecordModel | null;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    BadRequestError(message: string, errData?: unknown): ApiError;
    constructor(requestEvent: RequestEvent, collection: Collection, record: RecordModel | null);
}
export declare class RecordEnrichEvent extends Event {
    #private;
    App: App;
    RequestInfo: RequestInfo | null;
    Record: RecordModel | null;
    constructor(app: App, requestInfo: RequestInfo | null, record: RecordModel | null);
    Tags(): string[];
}
export declare class RecordCreateOTPRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    Record: RecordModel | null;
    Password: string;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collection: Collection, record: RecordModel | null);
}
export declare class RecordAuthWithOTPRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    Record: RecordModel | null;
    OTP: unknown;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collection: Collection, record: RecordModel | null);
}
export declare class RecordAuthRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    Record: RecordModel | null;
    Token: string;
    Meta: unknown;
    AuthMethod: string;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collection: Collection, record: RecordModel | null);
}
export declare class RecordAuthWithPasswordRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    Record: RecordModel | null;
    Identity: string;
    IdentityField: string;
    Password: string;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collection: Collection, record: RecordModel | null);
}
export declare class RecordAuthWithOAuth2RequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    ProviderName: string;
    ProviderClient: unknown;
    Record: RecordModel | null;
    OAuth2User: unknown;
    CreateData: Record<string, unknown>;
    IsNewRecord: boolean;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collection: Collection, record: RecordModel | null);
}
export declare class RecordAuthRefreshRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    Record: RecordModel | null;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collection: Collection, record: RecordModel | null);
}
export declare class RecordRequestPasswordResetRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    Record: RecordModel | null;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collection: Collection, record: RecordModel | null);
}
export declare class RecordConfirmPasswordResetRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    Record: RecordModel | null;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collection: Collection, record: RecordModel | null);
}
export declare class RecordRequestVerificationRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    Record: RecordModel | null;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collection: Collection, record: RecordModel | null);
}
export declare class RecordConfirmVerificationRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    Record: RecordModel | null;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collection: Collection, record: RecordModel | null);
}
export declare class RecordRequestEmailChangeRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    Record: RecordModel | null;
    NewEmail: string;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collection: Collection, record: RecordModel | null);
}
export declare class RecordConfirmEmailChangeRequestEvent extends Event {
    RequestEvent: RequestEvent;
    Collection: Collection;
    Record: RecordModel | null;
    NewEmail: string;
    Tags: () => string[];
    get App(): App;
    set App(app: App);
    constructor(requestEvent: RequestEvent, collection: Collection, record: RecordModel | null);
}
export {};
