export declare const BRIEFING_ARTIFACT_FORMATS: readonly ["markdown", "html"];

export declare const BRIEFING_CONTENT_LIMITS: {
    readonly maxBlocks: 50;
    readonly maxTableRows: 100;
    readonly maxTableColumns: 20;
    readonly maxTableCellCharacters: 500;
    readonly maxParagraphCharacters: 5000;
    readonly maxFindingCharacters: 5000;
    readonly maxListItems: 100;
    readonly maxKpiTiles: 8;
};

export declare const BRIEFING_KIND: "BRIEFING";

export declare const BRIEFING_TEXT_LIMITS: {
    readonly name: 500;
    readonly description: 2000;
    readonly instruction: 50000;
    readonly customMessage: 50000;
    readonly contentTitle: 500;
    readonly contentSummary: 20000;
    readonly contentText: 5000;
    readonly contentSql: 50000;
    readonly contentItem: 2000;
    readonly contentCell: 500;
    readonly attachmentTitle: 500;
    readonly presentationAudience: 1000;
    readonly presentationTone: 500;
    readonly presentationFormat: 2000;
    readonly id: 500;
};

export declare type BriefingArtifactFormat = (typeof BRIEFING_ARTIFACT_FORMATS)[number];

export declare type BriefingAttachment = (BriefingAttachmentBase & {
    type: 'dashboard';
    dashboardId: string;
    format: 'pdf';
}) | (BriefingAttachmentBase & {
    type: 'dashboard_sheet';
    dashboardId: string;
    sheetId: string;
    format: 'pdf';
}) | (BriefingAttachmentBase & {
    type: 'document_sheet';
    dashboardId: string;
    sheetId: string;
    format: 'pdf';
}) | (BriefingAttachmentBase & {
    type: 'visual';
    dashboardId: string;
    visualId: string;
    format: 'pdf' | 'png';
}) | (BriefingAttachmentBase & {
    type: 'card';
    dashboardId: string;
    cardId: string;
    format: 'csv' | 'pdf' | 'png';
});

declare type BriefingAttachmentBase = {
    title?: string;
    settings?: BriefingAttachmentSettings;
};

export declare type BriefingAttachmentFormat = 'pdf' | 'csv' | 'png';

export declare type BriefingAttachmentSettings = {
    theme?: string;
    pageSize?: BriefingPdfPageSize;
    orientation?: BriefingPdfOrientation;
    includeFilters?: boolean;
    includeTimestamp?: boolean;
    delimiter?: BriefingCsvDelimiter;
    includeHeaders?: boolean;
    useFormattedValues?: boolean;
    sheetSelection?: BriefingSheetSelection;
    currentSheetId?: string;
    currentSheetName?: string;
    filterValues?: unknown[];
    inlineFilterValues?: unknown[];
    sheetFilterValues?: unknown[];
    filterLine?: string;
    controlValues?: Record<string, unknown>;
    controlDefinitions?: unknown[];
    cardControlDefinitions?: unknown[];
    controlBindings?: unknown[];
    tablePreferences?: Record<string, unknown>;
    dashboardInputExecutionSnapshot?: Record<string, unknown>;
    selectedSheetId?: string;
    cardType?: string;
};

export declare type BriefingBody = {
    type: 'generated_analysis';
    instruction: string;
} | {
    type: 'custom_message';
    message: string;
} | {
    type: 'none';
};

export declare type BriefingChannelConfig = {
    formatProfile?: BriefingFormatProfile;
    subjectOverride?: string;
    titleOverride?: string;
    summaryOverride?: string;
    actionBlockVisible?: boolean;
    slackConfig?: BriefingSlackConfig;
    webhookConfig?: BriefingWebhookConfig;
};

export declare type BriefingContentBlock = {
    type: 'heading';
    text: string;
    level?: 2 | 3;
    evidenceIds?: string[];
} | {
    type: 'paragraph';
    text: string;
    evidenceIds?: string[];
} | {
    type: 'finding';
    title?: string;
    text: string;
    severity?: BriefingContentSeverity;
    evidenceIds: string[];
} | {
    type: 'bullets';
    title?: string;
    items: string[];
    evidenceIds?: string[];
} | {
    type: 'metric';
    label: string;
    value: string | number;
    previousValue?: string | number | null;
    delta?: string | number | null;
    unit?: string;
    evidenceIds?: string[];
} | {
    type: 'kpi_grid';
    title?: string;
    tiles: BriefingKpiTile[];
    evidenceIds?: string[];
} | {
    type: 'progress';
    label: string;
    value: number;
    detail?: string;
    evidenceIds?: string[];
} | BriefingContentTableBlock | {
    type: 'actions';
    title?: string;
    items: string[];
    evidenceIds?: string[];
} | {
    type: 'limitations';
    title?: string;
    items: string[];
    evidenceIds?: string[];
} | {
    type: 'sql';
    title?: string;
    sql: string;
    evidenceIds?: string[];
} | {
    type: 'evidence_appendix';
    title?: string;
    evidenceIds: string[];
};

export declare type BriefingContentColumnAlign = 'left' | 'center' | 'right';

export declare type BriefingContentColumnKind = 'text' | 'number' | 'currency' | 'percent' | 'date' | 'boolean';

export declare type BriefingContentDocument = {
    version: 1;
    title?: string;
    summary?: string;
    blocks: BriefingContentBlock[];
};

export declare type BriefingContentScalar = string | number | boolean | null;

export declare type BriefingContentSeverity = 'info' | 'positive' | 'warning' | 'critical';

export declare type BriefingContentTableBlock = {
    type: 'table';
    id?: string;
    title?: string;
    columns: BriefingContentTableColumn[];
    rows: Array<Record<string, BriefingContentScalar>>;
    caption?: string;
    totalRows?: number;
    evidenceIds?: string[];
};

export declare type BriefingContentTableColumn = {
    key: string;
    label: string;
    kind?: BriefingContentColumnKind;
    align?: BriefingContentColumnAlign;
};

export declare class BriefingContractError extends Error {
    readonly issues: BriefingValidationIssue[];
    constructor(issues: BriefingValidationIssue[]);
}

export declare type BriefingCsvDelimiter = ',' | ';' | '\t';

export declare type BriefingDeliveryChannel = 'EMAIL' | 'WEBHOOK' | 'SLACK' | 'IN_APP' | 'TELEGRAM';

export declare type BriefingDeliveryConfig = {
    recipients: BriefingRecipient[];
    channels: BriefingDeliveryChannel[];
    channelConfigs?: Partial<Record<BriefingDeliveryChannel, BriefingChannelConfig>>;
};

export declare type BriefingDraft = {
    name: string;
    description?: string | null;
    status?: BriefingStatus;
    scheduleExpr?: string | null;
    timezone?: string;
    source?: BriefingSource;
    body: BriefingBody;
    attachments?: BriefingAttachment[];
    presentation?: Partial<BriefingPresentation>;
    limits?: BriefingLimits;
    deliveryConfig?: BriefingDeliveryConfig | null;
};

export declare type BriefingFormatProfile = 'concise' | 'balanced' | 'detailed';

export declare type BriefingJobConfig = {
    kind: BriefingKind;
    source: BriefingSource;
    body: BriefingBody;
    attachments: BriefingAttachment[];
    presentation: BriefingPresentation;
    limits?: BriefingLimits;
};

export declare type BriefingKind = typeof BRIEFING_KIND;

export declare type BriefingKpiTile = {
    label: string;
    value: string | number;
    previousValue?: string | number | null;
    delta?: string | number | null;
    unit?: string;
    evidenceIds?: string[];
};

export declare type BriefingLimits = {
    maxToolCalls?: number;
    maxRows?: number;
    timeoutMs?: number;
};

export declare type BriefingPdfOrientation = 'portrait' | 'landscape';

export declare type BriefingPdfPageSize = 'letter' | 'legal' | 'a4' | 'a3' | 'tabloid';

export declare type BriefingPresentation = {
    artifactFormats: BriefingArtifactFormat[];
    includeEvidence: boolean;
    includeSql: boolean;
    audience?: string;
    tone?: string;
    format?: string;
};

export declare type BriefingRecipient = {
    type: 'email';
    address: string;
    name?: string;
} | {
    type: 'user';
    userId: string;
} | {
    type: 'tenant_user';
    tenantUserId: string;
} | {
    type: 'group';
    groupId: string;
};

export declare type BriefingSheetSelection = 'current' | 'all';

export declare type BriefingSlackChannelDestination = {
    type: 'channel';
    channelId: string;
    channelName?: string;
    isPrivate?: boolean;
};

export declare type BriefingSlackConfig = {
    destination: BriefingSlackDestination;
    threadMentions?: BriefingRecipient[];
    postThreadDetail?: boolean;
    includeDashboardLink?: boolean;
    includeBriefingLink?: boolean;
};

export declare type BriefingSlackDestination = BriefingSlackChannelDestination | BriefingSlackDmDestination;

export declare type BriefingSlackDmDestination = {
    type: 'dm';
    recipient: BriefingRecipient;
};

export declare type BriefingSource = {
    type: 'project';
} | {
    type: 'dashboard';
    dashboardId: string;
};

export declare type BriefingStatus = 'ACTIVE' | 'PAUSED' | 'DISABLED';

export declare type BriefingValidationIssue = {
    field: string;
    message: string;
};

export declare type BriefingValidationResult<T = unknown> = {
    valid: true;
    value: T;
    issues: [];
} | {
    valid: false;
    issues: BriefingValidationIssue[];
};

export declare type BriefingWebhookConfig = {
    url: string;
    method?: 'POST' | 'PUT';
    headers?: Record<string, string>;
    secretEncrypted?: string;
};

export declare function buildBriefingJobConfig(input: Omit<Partial<BriefingJobConfig>, 'kind'> & {
    body: BriefingBody;
}): BriefingJobConfig;

export declare function buildCreateBriefingRequest(draft: BriefingDraft): CreateBriefingRequest;

export declare function buildUpdateBriefingRequest(draft: BriefingDraft): UpdateBriefingRequest;

export declare type CreateBriefingRequest = {
    name: string;
    description: string | null;
    status: BriefingStatus;
    scheduleExpr: string | null;
    timezone: string;
    source: BriefingSource;
    body: BriefingBody;
    attachments: BriefingAttachment[];
    presentation: BriefingPresentation;
    limits?: BriefingLimits;
    deliveryConfig: BriefingDeliveryConfig | null;
};

export declare const DEFAULT_BRIEFING_ARTIFACT_FORMATS: readonly ["markdown"];

export declare function isBriefingArtifactFormat(input: unknown): input is BriefingArtifactFormat;

export declare function isBriefingDeliveryChannel(input: unknown): input is BriefingDeliveryChannel;

export declare const MAX_BRIEFING_ATTACHMENTS = 20;

export declare function normalizeBriefingContentDocument(input: unknown): BriefingContentDocument;

export declare function normalizeBriefingDraft(input: unknown): CreateBriefingRequest;

export declare function normalizeBriefingJobConfig(input: unknown): BriefingJobConfig;

export declare type UpdateBriefingRequest = CreateBriefingRequest;

export declare function validateBriefingContentDocument(input: unknown): BriefingValidationResult<BriefingContentDocument>;

export declare function validateBriefingDraft(draft: unknown): BriefingValidationResult<CreateBriefingRequest>;

export declare function validateBriefingJobConfig(input: unknown): BriefingValidationResult<BriefingJobConfig>;

export { }
