import type { IDomain } from './domain.js';
import type { IDnsRecord, TDnsRecordType } from './dns-record.js';
import type { IApiTokenPolicy, TApiTokenScope, TGatewayClientType } from './route-management.js';
export interface IGatewayCapabilities {
    routes: {
        read: boolean;
        write: boolean;
        idempotentSync: boolean;
    };
    domains: {
        read: boolean;
        write: boolean;
    };
    certificates: {
        read: boolean;
        export: boolean;
        forceRenew: boolean;
    };
    email: {
        domains: boolean;
        inbound: boolean;
        outbound: boolean;
    };
    remoteIngress: {
        enabled: boolean;
    };
    dns: {
        authoritative: boolean;
        providerManaged: boolean;
    };
    http3: {
        enabled: boolean;
    };
}
export interface IGatewayClientContext {
    role: IApiTokenPolicy['role'];
    scopes: TApiTokenScope[];
    gatewayClient?: {
        type: TGatewayClientType;
        id: string;
    };
    hostnamePatterns: string[];
    allowedRouteTargets: NonNullable<IApiTokenPolicy['allowedRouteTargets']>;
    capabilities: NonNullable<IApiTokenPolicy['capabilities']>;
}
export interface IGatewayClient {
    id: string;
    type: TGatewayClientType;
    name: string;
    description?: string;
    hostnamePatterns: string[];
    allowedRouteTargets: NonNullable<IApiTokenPolicy['allowedRouteTargets']>;
    capabilities: NonNullable<IApiTokenPolicy['capabilities']>;
    enabled: boolean;
    tokenCount?: number;
    createdAt: number;
    updatedAt: number;
    createdBy: string;
}
export interface IGatewayClientDomain extends IDomain {
    capabilities: {
        canCreateSubdomains: boolean;
        canManageDnsRecords: boolean;
        canIssueCertificates: boolean;
        canHostEmail: boolean;
    };
    serviceCount?: number;
    managePath?: string;
}
/** @deprecated Use IGatewayClientDomain. */
export type IWorkHosterDomain = IGatewayClientDomain;
export interface IGatewayClientOwnership {
    gatewayClientType?: TGatewayClientType;
    gatewayClientId?: string;
    appId: string;
    hostname: string;
}
/** @deprecated Use IGatewayClientOwnership. */
export interface IWorkAppRouteOwnership {
    workHosterType: TGatewayClientType;
    workHosterId: string;
    workAppId: string;
    hostname: string;
}
export interface IGatewayClientRouteSyncResult {
    success: boolean;
    action?: 'created' | 'updated' | 'deleted' | 'unchanged';
    routeId?: string;
    message?: string;
}
/** @deprecated Use IGatewayClientRouteSyncResult. */
export type IWorkAppRouteSyncResult = IGatewayClientRouteSyncResult;
export interface IGatewayClientDnsRecord extends Omit<IDnsRecord, 'type'> {
    type: TDnsRecordType | 'MISSING';
    domainName?: string;
    status: 'active' | 'missing';
    gatewayClientType: TGatewayClientType;
    gatewayClientId: string;
    appId: string;
    hostname: string;
    routeId?: string;
    serviceName?: string;
    managePath?: string;
}
export interface IGatewayClientMailOwnership {
    gatewayClientType: TGatewayClientType;
    gatewayClientId: string;
    appId: string;
}
export interface IWorkAppMailOwnership {
    workHosterType: TGatewayClientType;
    workHosterId: string;
    workAppId: string;
}
export interface IWorkAppMailInboundRoute {
    enabled: boolean;
    targetHost: string;
    targetPort: number;
    preserveHeaders?: boolean;
    addHeaders?: Record<string, string>;
}
export interface IWorkAppMailIdentity {
    id: string;
    externalKey: string;
    ownership: IWorkAppMailOwnership;
    address: string;
    localPart: string;
    domain: string;
    enabled: boolean;
    displayName?: string;
    inbound?: IWorkAppMailInboundRoute;
    smtp: {
        enabled: boolean;
        username: string;
    };
    createdAt: number;
    updatedAt: number;
    createdBy: string;
}
export interface IWorkAppMailCredentials {
    username: string;
    password: string;
    host?: string;
    ports?: {
        smtp?: number;
        submission?: number;
        smtps?: number;
    };
}
export interface IWorkAppMailIdentitySyncResult {
    success: boolean;
    action?: 'created' | 'updated' | 'deleted' | 'unchanged';
    identity?: IWorkAppMailIdentity;
    smtpCredentials?: IWorkAppMailCredentials;
    message?: string;
}
