import type { FieldDefinition, FieldDefinitionInput, SdkCustomBlock, SdkCustomBlockInput, SiteFooterContent, Theme } from "../../blocks/src/index";
import type { LinkPayload } from "./navigation/types";
/**
 * SDK Site Configuration Types
 *
 * These types live in `@riverbankcms/api` to avoid a circular dependency with
 * `@riverbankcms/sdk/config`, while the canonical validation schemas live in
 * `packages/api/src/sdkConfig/contracts.ts`.
 *
 * Note: Do NOT use these API types when validating config data. The schema module
 * can apply defaults and transforms; these types are for API request/response typing.
 */
/** SDK theme palette - maps token names to CSS color values */
export type SdkThemePalette = Record<string, string>;
/** SDK theme configuration */
export interface SdkThemeConfig {
    palette: SdkThemePalette;
}
/** Section background with token reference */
export interface SdkSectionBackground {
    id: string;
    label: string;
    token: string;
}
export interface SdkSectionOptionsConfig {
    backgroundColor?: boolean;
    backgroundImage?: boolean;
    backgroundGradient?: boolean;
    spacing?: ("compact" | "default" | "spacious")[] | boolean;
    textColor?: boolean;
}
export interface SdkContainerOptionsConfig {
    maxWidth?: ("narrow" | "default" | "wide" | "full")[] | boolean;
    alignment?: ("left" | "center" | "right")[] | boolean;
}
export interface SdkSiteStyleConfig {
    sectionBackgrounds?: SdkSectionBackground[];
    sectionOptions?: SdkSectionOptionsConfig;
    containerOptions?: SdkContainerOptionsConfig;
}
/**
 * Field select option for SDK-provided field options.
 *
 * Note: This mirrors FieldSelectOption from @riverbankcms/sdk/config for use in API responses.
 * The API package cannot depend on SDK, so these types are duplicated here.
 */
export interface SdkFieldSelectOption {
    value: string;
    label: string;
}
/**
 * Per-field configuration within a block.
 *
 * Note: This mirrors BlockFieldConfig from @riverbankcms/sdk/config for use in API responses.
 */
export interface SdkBlockFieldConfig {
    options?: SdkFieldSelectOption[];
}
/**
 * Per-block field configurations map.
 *
 * Note: This mirrors BlockFieldOptionsMap from @riverbankcms/sdk/config for use in API responses.
 */
export type SdkBlockFieldOptionsMap = Record<string, Record<string, SdkBlockFieldConfig>>;
export interface SdkSiteLayoutConfig {
    footerBlocks?: Array<{
        id?: string;
        kind: string;
        content?: Record<string, unknown>;
    }>;
}
export interface SdkContentTypeTemplateConfig {
    blocks: unknown[];
}
export interface SdkContentTypeConfig {
    key: string;
    fields: unknown[];
    template?: SdkContentTypeTemplateConfig | null;
}
export interface SdkContentConfig {
    contentTypes?: SdkContentTypeConfig[];
    pages?: unknown[];
    entries?: unknown[];
    navigationMenus?: unknown[];
    settings?: unknown;
}
export type SdkWorkflowManualTrigger = {
    type: "manual";
};
export type SdkWorkflowEntryDraftUpdatedCondition = Readonly<{
    field: string;
    changed: true;
}> | Readonly<{
    field: string;
    isEmpty: boolean;
}>;
export type SdkWorkflowEntryDraftUpdatedTrigger = {
    type: "entry.draft.updated";
    when: SdkWorkflowEntryDraftUpdatedCondition[];
};
export type SdkWorkflowTrigger = SdkWorkflowManualTrigger | SdkWorkflowEntryDraftUpdatedTrigger;
export type SdkWorkflowConfirmation = {
    title: string;
    body?: string;
};
export interface SdkWorkflowConfig {
    id: string;
    title: string;
    description?: string;
    contentType: string;
    endpoint: string;
    triggers: SdkWorkflowTrigger[];
    confirmation?: SdkWorkflowConfirmation;
}
export type DashboardSiteRole = "administrator" | "editor" | "team_member";
export interface DashboardNavVisibilityConfig {
    mode?: "augment" | "restrict";
    allowIds?: string[];
    denyIds?: string[];
}
export interface DashboardNavVisibilityConfigWithRoles extends DashboardNavVisibilityConfig {
    roles?: Partial<Record<DashboardSiteRole, DashboardNavVisibilityConfig>>;
}
export interface DashboardNavigationConfig {
    siteNav?: DashboardNavVisibilityConfigWithRoles;
    settingsNav?: DashboardNavVisibilityConfigWithRoles;
}
export interface DashboardConfig {
    previewEditingEnabled?: boolean;
    navigation?: DashboardNavigationConfig;
}
export type SdkBlockFieldExtension = {
    fields: FieldDefinition[];
};
export type SdkBlockFieldExtensionsMap = Record<string, SdkBlockFieldExtension>;
/**
 * Input shape for SDK-provided field extensions.
 *
 * Allows omitting field defaults (e.g. `required`) that are applied by Zod.
 */
export type SdkBlockFieldExtensionInput = {
    fields: FieldDefinitionInput[];
};
export type SdkBlockFieldExtensionsInputMap = Record<string, SdkBlockFieldExtensionInput>;
export interface RiverbankSiteConfig {
    siteId: string;
    previewUrl?: string;
    liveUrl?: string;
    theme?: SdkThemeConfig;
    styles?: SdkSiteStyleConfig;
    layout?: SdkSiteLayoutConfig;
    /** Custom blocks defined by SDK sites */
    customBlocks?: SdkCustomBlock[];
    blockFieldOptions?: SdkBlockFieldOptionsMap;
    blockFieldExtensions?: SdkBlockFieldExtensionsMap;
    workflows?: SdkWorkflowConfig[];
    content?: SdkContentConfig;
    contentDir?: string;
    sync?: {
        existingEntries?: "skip" | "update";
    };
    deploy?: {
        verifyCommand?: string;
        prebuildOutput?: string;
    };
    themeSource?: "local" | "cms";
    activeTheme?: string;
    enablePortal?: boolean;
    dashboard?: DashboardConfig;
}
/**
 * Input shape accepted when pushing SDK site config.
 *
 * This is looser than RiverbankSiteConfig (which represents stored/returned config),
 * allowing field defaults to be omitted in custom block manifests.
 */
export interface RiverbankSiteConfigInput extends Omit<RiverbankSiteConfig, "customBlocks" | "blockFieldExtensions"> {
    customBlocks?: SdkCustomBlockInput[];
    blockFieldExtensions?: SdkBlockFieldExtensionsInputMap;
}
export type PushSdkConfigRequest = {
    config: RiverbankSiteConfigInput;
    forceContentTypes?: boolean;
};
export type SyncCollectionResult = {
    created: number;
    updated: number;
    skipped: number;
    deleted?: number;
    errors: string[];
    warnings: string[];
};
export type SyncSettingsResult = {
    updated: boolean;
    error: string | null;
};
export type SdkContentSyncResult = {
    success: boolean;
    contentTypes: SyncCollectionResult;
    customBlocks: SyncCollectionResult;
    templateBlocks: SyncCollectionResult;
    pages: SyncCollectionResult;
    entries: SyncCollectionResult;
    navigationMenus: SyncCollectionResult;
    settings: SyncSettingsResult;
};
export type IgnoredDocumentSyncSection = 'pages' | 'entries' | 'navigationMenus';
export declare function formatIgnoredDocumentSyncSectionWarning(section: IgnoredDocumentSyncSection): string;
export type SyncFooterBlocksResult = {
    updated: boolean;
    skipped: boolean;
};
export type SdkConfigSyncResult = {
    success: boolean;
    contentTypes: SyncCollectionResult;
    customBlocks: SyncCollectionResult;
    templateBlocks: SyncCollectionResult;
    settings: SyncSettingsResult;
    footerBlocks: SyncFooterBlocksResult;
    ignoredDocumentSections: IgnoredDocumentSyncSection[];
};
export type PushSdkConfigResponse = {
    success: true;
    message: string;
    /**
     * Legacy all-content-shaped sync payload retained for published CLIs that
     * still read document sync buckets such as `sync.pages.errors`.
     */
    sync: SdkContentSyncResult | null;
    /**
     * Schema/config-only push-config result. New clients should prefer this over
     * `sync` so document sections stay unrepresentable in the active contract.
     */
    configSync: SdkConfigSyncResult | null;
};
export interface SdkBackfillPageResult {
    pagesUpdated: number;
    identifiersAssigned: Record<string, string>;
}
export interface SdkBackfillBlockResult {
    blocksUpdated: number;
    identifiersAssigned: Record<string, string>;
}
export interface SdkBackfillEntryResult {
    entriesUpdated: number;
    identifiersAssigned: Record<string, string>;
}
export interface SdkBackfillIdentifiersResult {
    pages: SdkBackfillPageResult;
    blocks: {
        total: number;
        byPage: Record<string, SdkBackfillBlockResult>;
    };
    entries: SdkBackfillEntryResult;
}
export interface ManagementMediaAsset {
    id: string;
    siteId: string;
    identifier: string | null;
    storageBucket: string;
    storagePath: string;
    filename: string;
    mimeType: string;
    width: number | null;
    height: number | null;
    bytes: number | null;
    checksumSha256: string | null;
    createdAt: string;
    updatedAt: string;
}
export interface MediaResolveResponse {
    assets: ManagementMediaAsset[];
    missingIdentifiers: string[];
    missingAssetIds: string[];
}
export interface SdkMediaUploadUrlResponse {
    signedUrl: string;
    storagePath: string;
    bucket: string;
}
export interface SdkMediaFinalizeUploadResponse {
    storagePath: string;
    status: "created" | "exists";
    assetId: string;
    identifier: string | null;
}
export interface SdkPullMeta {
    pulledAt: string;
}
export interface SdkPullSiteInfoResponse {
    supabaseUrl: string;
    meta: {
        fetchedAt: string;
    };
}
export interface SdkPullContentType {
    key: string;
    name: string;
    hasPages: boolean;
    routePattern: string | null;
    isSingleton: boolean;
}
export interface SdkPullContentTypesResponse {
    contentTypes: SdkPullContentType[];
    meta: SdkPullMeta;
}
export interface SdkPullPageBlock {
    id: string;
    identifier: string;
    kind: string;
    position: number;
    data: Record<string, unknown>;
    createdAt: string;
    updatedAt: string;
}
export interface SdkPullPage {
    id: string;
    identifier: string;
    title: string;
    path: string;
    status: "draft" | "published";
    hasUnpublishedChanges: boolean;
    updatedAt: string;
    createdAt: string;
    publishedAt: string | null;
    blocks: SdkPullPageBlock[];
}
export interface SdkPullPagesResponse {
    pages: SdkPullPage[];
    meta: SdkPullMeta;
}
export interface SdkPullNavigationItem {
    id: string;
    menuId: string;
    label: string;
    link: LinkPayload | null;
    isCta?: boolean;
    position: number;
    parentId: string | null;
    children?: SdkPullNavigationItem[];
    resolvedIdentifier?: string | null;
    resolvedContentType?: string | null;
}
export interface SdkPullNavigationMenu {
    id: string;
    siteId: string;
    identifier: string | null;
    name: string;
    isPrimary: boolean;
    isFooter: boolean;
    items: SdkPullNavigationItem[];
    createdAt: string;
    updatedAt: string;
}
export interface SdkPullNavigationResponse {
    menus: SdkPullNavigationMenu[];
    meta: SdkPullMeta;
}
export interface SdkPullSettings {
    homepageId: string | null;
    seoDefaults: {
        title?: string;
        description?: string;
        ogImage?: string;
        allowIndexingInProduction?: boolean;
    } | null;
    logoIdentifier?: string | null;
    faviconIdentifier?: string | null;
}
export interface SdkPullSettingsResponse {
    settings: SdkPullSettings;
    warnings?: string[];
    meta: SdkPullMeta;
}
export interface SdkPullFormField {
    id: string;
    label: string;
    type: string;
    required?: boolean;
    placeholder?: string;
    helpText?: string;
    options?: Array<{
        value: string;
        label: string;
    }>;
    multiple?: boolean;
    minLength?: number;
    maxLength?: number;
    pattern?: string;
    min?: number;
    max?: number;
}
export interface SdkPullFormSchema {
    version?: string;
    fields: SdkPullFormField[];
}
export type SdkPullFormSettings = Record<string, unknown>;
export interface SdkPullForm {
    slug: string;
    name: string;
    schema: SdkPullFormSchema;
    settings: SdkPullFormSettings;
    updatedAt: string;
    createdAt: string;
}
export interface SdkPullFormsResponse {
    forms: SdkPullForm[];
    meta: SdkPullMeta;
}
export interface SdkPullThemeMeta extends SdkPullMeta {
    updatedAt: string | null;
}
export interface SdkPullThemeResponse {
    theme: Theme | null;
    themeId: string | null;
    selectionId: string | null;
    meta: SdkPullThemeMeta;
}
export interface SdkPullFooterMeta extends SdkPullMeta {
    updatedAt: string | null;
}
export interface SdkPullFooterResponse {
    footer: SiteFooterContent | null;
    meta: SdkPullFooterMeta;
}
export interface SdkPullVenue {
    slug: string;
    title: string;
    description: string | null;
    timezone: string | null;
    capacity: number | null;
    address: {
        line1?: string;
        line2?: string;
        city?: string;
        region?: string;
        postcode?: string;
        country?: string;
    };
    location: {
        lat?: number;
        lng?: number;
    } | null;
    mapEmbed: string | null;
    updatedAt: string;
    createdAt: string;
}
export interface SdkPullVenuesResponse {
    venues: SdkPullVenue[];
    meta: SdkPullMeta;
}
export interface SdkPullEventCategory {
    identifier: string;
    name: string;
    description: string | null;
    color: string | null;
    sortOrder: number;
    updatedAt: string;
    createdAt: string;
}
export interface SdkPullEventCategoriesResponse {
    eventCategories: SdkPullEventCategory[];
    meta: SdkPullMeta;
}
export interface SdkPullEventSeries {
    identifier: string;
    title: string;
    slug: string;
    /**
     * Mirrors `event_series.status` from the bookings system.
     *
     * IMPORTANT: This must be roundtrip-safe for SDK pull -> push workflows.
     */
    status: "draft" | "active" | "archived" | "cancelled" | "completed";
    /**
     * Mirrors `event_series.visibility` from the bookings system.
     *
     * IMPORTANT: This must be roundtrip-safe for SDK pull -> push workflows.
     */
    visibility: "private" | "public" | "unlisted";
    schedule: {
        recurrenceRule: string | null;
        /** Date used for the first occurrence; required for one-off SDK-managed events. */
        startDate?: string | null;
        defaultStartTime: string;
        durationMinutes: number;
    };
    capacity: number | null;
    pricing: {
        requiresPayment: boolean;
        priceAmount: number | null;
        priceCurrency: string | null;
        priceDisplay: string | null;
        acceptsPasses: boolean;
        acceptsMemberships: boolean;
    };
    venueRef: string | null;
    categoryRef: string | null;
    content: {
        summary?: string;
        body?: string | Record<string, unknown>;
        image?: string | Record<string, unknown>;
        [key: string]: unknown;
    };
    formRef: string | null;
    settings: Record<string, unknown>;
    presentation: Record<string, unknown> | null;
    tags: string[];
    updatedAt: string;
    createdAt: string;
    contentUpdatedAt: string | null;
}
export interface SdkPullEventsResponse {
    events: SdkPullEventSeries[];
    meta: SdkPullMeta;
}
export interface SdkPullCourseSession {
    startsAt: string;
    endsAt: string;
}
export interface SdkPullCourseProgram {
    identifier: string | null;
    data: Record<string, unknown>;
}
export interface SdkPullCourseRun {
    identifier: string;
    title: string;
    slug: string;
    status: "draft" | "active" | "archived" | "cancelled" | "completed";
    visibility: "private" | "public" | "unlisted";
    venueRef: string | null;
    categoryRef: string | null;
    formRef: string | null;
    capacity: number | null;
    enrollmentCapacity: number | null;
    acceptsMemberships: boolean;
    priceCents: number | null;
    currency: string;
    sessions: SdkPullCourseSession[];
    programRef: string | null;
    program: SdkPullCourseProgram | null;
    updatedAt: string;
    createdAt: string;
}
export interface SdkPullCoursesResponse {
    courses: SdkPullCourseRun[];
    meta: SdkPullMeta;
}
export interface SdkCourseSessionConflict {
    code: "course_sessions_enrolled_conflict";
    identifier: string;
    enrollmentCount: number;
    message: string;
}
export interface SdkPulledEntry {
    identifier: string;
    title: string;
    data: Record<string, unknown>;
    status: "draft" | "published";
    hasUnpublishedChanges: boolean;
    slug?: string;
}
export interface SdkPullEntryTimestamps {
    createdAt: string;
    updatedAt: string;
    publishedAt: string | null;
}
export interface SdkPullPagination {
    page: number;
    limit: number;
    total: number;
    hasMore: boolean;
}
export interface SdkPullEntriesResponse {
    entries: Array<SdkPulledEntry & {
        contentType: string;
    }>;
    meta: SdkPullMeta & {
        entries: Record<string, SdkPullEntryTimestamps>;
        truncated: boolean;
        truncationMessage?: string;
    };
    pagination: SdkPullPagination;
}
export interface SdkPullEntriesByTypeResponse {
    contentType: string;
    entries: SdkPulledEntry[];
    meta: SdkPullMeta & {
        entries: Record<string, SdkPullEntryTimestamps>;
    };
    pagination: SdkPullPagination;
}
export interface SdkPullEntriesAllResponse {
    entries: Record<string, SdkPulledEntry[]>;
    meta: SdkPullMeta & {
        totalEntries: number;
        contentTypes: string[];
        entries: Record<string, SdkPullEntryTimestamps>;
        truncated: boolean;
        truncationMessage?: string;
    };
}
export interface SdkManagementPage {
    id: string;
    identifier: string;
    title: string;
    path: string;
    status: "draft" | "published";
    hasUnpublishedChanges: boolean;
    createdAt: string;
    updatedAt: string;
    publishedAt: string | null;
}
export interface SdkManagementBlock {
    id: string;
    identifier: string;
    kind: string;
    position: number;
    data: Record<string, unknown>;
    createdAt: string;
    updatedAt: string;
}
export interface SdkManagementEntry {
    id: string;
    identifier: string;
    contentType: string;
    slug?: string;
    title: string;
    data: Record<string, unknown>;
    publishedData?: Record<string, unknown> | null;
    status: "draft" | "published";
    hasUnpublishedChanges: boolean;
    createdAt: string;
    updatedAt: string;
    publishedAt: string | null;
}
export type SdkManagementForm = SdkPullForm & {
    id: string;
};
export type SdkManagementVenue = SdkPullVenue & {
    id: string;
};
export type SdkManagementEventCategory = SdkPullEventCategory & {
    id: string;
};
export type SdkManagementEventSeries = SdkPullEventSeries & {
    id: string;
};
export type SdkManagementCourseRun = SdkPullCourseRun & {
    id: string;
    seriesId: string;
};
export interface SdkPageResponse {
    page: SdkManagementPage;
}
export interface SdkUpsertBlockResponse {
    block: SdkManagementBlock;
}
export interface SdkDeleteResponse {
    deleted: true;
}
export interface SdkReorderResponse {
    reordered: true;
}
export interface SdkUpsertEntryResponse {
    entry: Omit<SdkManagementEntry, "publishedData">;
}
export interface SdkPublishOrUnpublishEntryResponse {
    entry: Omit<SdkManagementEntry, "publishedData">;
}
export interface SdkListEntriesResponse {
    items: SdkManagementEntry[];
    pagination: SdkPullPagination;
}
export type SdkGetEntryResponse = SdkManagementEntry;
export interface SdkListFormsResponse {
    forms: SdkManagementForm[];
}
export interface SdkUpsertFormResponse {
    form: SdkManagementForm;
}
export interface SdkGetFormResponse {
    form: SdkManagementForm;
}
export interface SdkListVenuesResponse {
    venues: SdkManagementVenue[];
}
export interface SdkUpsertVenueResponse {
    venue: SdkManagementVenue;
}
export interface SdkGetVenueResponse {
    venue: SdkManagementVenue;
}
export interface SdkListEventCategoriesResponse {
    eventCategories: SdkManagementEventCategory[];
}
export interface SdkUpsertEventCategoryResponse {
    eventCategory: SdkManagementEventCategory;
}
export interface SdkGetEventCategoryResponse {
    eventCategory: SdkManagementEventCategory;
}
export interface SdkListEventsResponse {
    events: SdkManagementEventSeries[];
}
export interface SdkUpsertEventResponse {
    event: SdkManagementEventSeries;
}
export interface SdkGetEventResponse {
    event: SdkManagementEventSeries;
}
export interface SdkListCoursesResponse {
    courses: SdkManagementCourseRun[];
}
export interface SdkUpsertCourseResponse {
    course: SdkManagementCourseRun;
}
export interface SdkGetCourseResponse {
    course: SdkManagementCourseRun;
}
export interface SdkUpsertNavigationMenuResponse {
    menu: {
        id: string;
        name: string;
        isPrimary: boolean;
        isFooter: boolean;
        items: SdkPullNavigationItem[];
        createdAt: string;
        updatedAt: string;
    };
}
export interface SdkUpsertThemeResponse {
    themeId: string;
    selectionId: string;
    savedAt: string;
}
export interface SdkUpsertFooterResponse {
    footer: SiteFooterContent | null;
}
export interface SdkUpdateSettingsResponse {
    settings: SdkPullSettings;
}
