/**
 * SDK Site Configuration Types
 *
 * These types define the schema for SDK site configuration that can be
 * declared in code and consumed by tooling.
 */
import type { ContentConfig } from './content-types';
import type { FieldDefinition } from './field-definitions';
import type { NodeDefinition } from '../contracts';
export type { FieldDefinition } from './field-definitions';
export type { ContentConfig, ContentTypeConfig, PageConfig, EntryConfig, BlockConfig, NavigationMenuConfig, NavigationItemConfig, NavigationLinkType, SiteSettingsConfig, } from './content-types';
/**
 * SDK-defined theme palette.
 *
 * SDK sites define their own color palette with semantic token names.
 * These tokens can then be referenced in style configurations.
 *
 * @example
 * ```typescript
 * palette: {
 *   primary: '#6d28d9',
 *   secondary: '#4c1d95',
 *   accent: '#FF007F',
 *   highlight: '#facc15',
 * }
 * ```
 */
export type SdkThemePalette = Record<string, string>;
/**
 * SDK-defined theme configuration.
 *
 * This allows SDK sites to define their own theme that's used for
 * token resolution in the editor and at render time.
 */
export interface SdkThemeConfig {
    /**
     * Color palette mapping token names to CSS color values.
     * Token names are arbitrary and defined by the SDK site.
     */
    palette: SdkThemePalette;
}
export type BlockCategory = 'marketing' | 'content' | 'blog' | 'media' | 'layout' | 'interactive';
/**
 * Supported CMS endpoints for SDK custom block data loaders.
 *
 * Re-exported from `@riverbankcms/blocks` (single source of truth).
 */
export declare const SUPPORTED_LOADER_ENDPOINTS: readonly ["listPublishedEntries", "getPublishedEntryPreview", "listPublicEvents", "getPublicEventDetails", "listPublicCourses", "listPublicTeamMembers", "listPublicProducts", "listPublicPasses", "listPublicMemberships", "getPublicFormById", "getPublicBookingServices"];
export type SdkLoaderEndpoint = (typeof SUPPORTED_LOADER_ENDPOINTS)[number];
export type LoaderParamBinding = {
    $bind: {
        from: string;
        fallback?: unknown;
        transforms?: Array<{
            id: string;
            options?: Record<string, unknown>;
        }>;
    };
};
export type LoaderParamValue = string | number | boolean | LoaderParamBinding;
export type LoaderWhenValue = boolean | LoaderParamBinding;
export interface SdkConfigLoader {
    endpoint: SdkLoaderEndpoint;
    params: Record<string, LoaderParamValue>;
    mode?: 'server' | 'client';
    when?: LoaderWhenValue;
}
export interface SdkCustomBlock {
    id: `custom.${string}`;
    title: string;
    titleSource?: string | string[];
    description?: string;
    category: BlockCategory;
    icon?: string;
    tags?: string[];
    fields: FieldDefinition[];
    dataLoaders?: Record<string, SdkConfigLoader>;
    layout?: NodeDefinition;
    variants?: Record<string, NodeDefinition>;
    defaultVariant?: string;
    variantOptions?: Record<string, {
        label?: string;
        description?: string;
        icon?: string;
    }>;
}
/**
 * Allowed spacing values in section styles.
 */
export type SectionSpacing = 'compact' | 'default' | 'spacious';
/**
 * Allowed container max-width values.
 */
export type ContainerMaxWidth = 'narrow' | 'default' | 'wide' | 'full';
/**
 * Allowed container alignment values.
 */
export type ContainerAlignment = 'left' | 'center' | 'right';
/**
 * A curated background color option for section styles.
 *
 * @example
 * ```typescript
 * sectionBackgrounds: [
 *   { id: 'primary', label: 'Purple', token: 'primary' },
 *   { id: 'accent', label: 'Pink', token: 'accent' },
 * ]
 * ```
 */
export interface SectionBackground {
    /** Unique identifier for this background option */
    id: string;
    /** Display name shown in the editor UI */
    label: string;
    /** Reference to a token in the theme palette */
    token: string;
}
/**
 * Configuration for which section style options are available.
 *
 * Each option can be:
 * - `false`: Hide the option entirely from the editor
 * - `true`: Show all supported values for that option
 * - Array: Show only the specified values (for options that support arrays)
 */
export interface SectionOptionsConfig {
    /** Enable/disable background color selection */
    backgroundColor?: boolean;
    /** Enable/disable background image selection */
    backgroundImage?: boolean;
    /** Enable/disable background gradient selection */
    backgroundGradient?: boolean;
    /** Control available spacing values, or disable entirely */
    spacing?: SectionSpacing[] | boolean;
    /** Enable/disable text color selection */
    textColor?: boolean;
}
/**
 * Configuration for which container style options are available.
 *
 * Each option can be:
 * - `false`: Hide the option entirely from the editor
 * - `true`: Show all supported values for that option
 * - Array: Show only the specified values
 */
export interface ContainerOptionsConfig {
    /** Control available max-width values, or disable entirely */
    maxWidth?: ContainerMaxWidth[] | boolean;
    /** Control available alignment values, or disable entirely */
    alignment?: ContainerAlignment[] | boolean;
}
/**
 * Site-level style configuration for SDK sites.
 *
 * This allows SDK sites to curate which styling options are available
 * to editors in the section styles panel.
 */
export interface SiteStyleConfig {
    /**
     * Curated list of background colors available in section styles.
     * If not specified, falls back to theme colors (current behavior).
     */
    sectionBackgrounds?: SectionBackground[];
    /**
     * Which section style options are enabled.
     * Options not listed or set to false are hidden from editors.
     */
    sectionOptions?: SectionOptionsConfig;
    /**
     * Container style constraints.
     */
    containerOptions?: ContainerOptionsConfig;
}
/**
 * A select option for SDK-provided field options.
 */
export interface FieldSelectOption {
    /** The value stored when this option is selected */
    value: string;
    /** Display label shown in the dropdown */
    label: string;
}
/**
 * Configuration for a specific field within a block.
 *
 * Currently supports overriding select options, but designed
 * for future extensions (defaultValue, required, etc.).
 */
export interface BlockFieldConfig {
    /** Override select options for this field */
    options?: FieldSelectOption[];
}
/**
 * Per-block field configurations.
 *
 * Maps block IDs to field configurations, where each field config
 * is keyed by field ID.
 *
 * @example
 * ```typescript
 * {
 *   'block.embed': {
 *     layout: {
 *       options: [
 *         { value: 'showcase', label: 'Showcase Grid' },
 *         { value: 'list', label: 'Simple List' },
 *       ]
 *     }
 *   }
 * }
 * ```
 */
export type BlockFieldOptionsMap = Record<string, Record<string, BlockFieldConfig>>;
/**
 * Configuration for extending a built-in block with additional fields.
 *
 * @example
 * ```typescript
 * {
 *   fields: [
 *     {
 *       id: 'layout',
 *       type: 'select',
 *       label: 'Layout',
 *       options: [
 *         { value: 'default', label: 'Default' },
 *         { value: 'wide', label: 'Wide' },
 *       ],
 *       defaultValue: 'default',
 *     },
 *   ],
 * }
 * ```
 */
export interface BlockFieldExtension {
    /**
     * Additional fields to append to the block's form.
     * Uses the same field definition format as block manifests.
     * All field types are supported.
     *
     * Note: If a field is marked as `required: true`, it MUST have a `defaultValue`.
     * This ensures existing blocks without this field can still be edited.
     */
    fields: FieldDefinition[];
}
/**
 * Map of block IDs to their field extensions.
 * Block IDs must be system blocks (e.g., 'block.body-text', 'block.hero').
 *
 * @example
 * ```typescript
 * {
 *   'block.body-text': {
 *     fields: [
 *       { id: 'layout', type: 'select', label: 'Layout', ... },
 *     ],
 *   },
 *   'block.hero': {
 *     fields: [
 *       { id: 'videoBackground', type: 'media', label: 'Video Background', ... },
 *     ],
 *   },
 * }
 * ```
 */
export type BlockFieldExtensionsMap = Record<string, BlockFieldExtension>;
/**
 * Sync behavior configuration for CLI push operations.
 *
 * Controls how the SDK CLI handles content synchronization.
 * Status changes (draft/published) are synced based on local file status.
 */
export interface SyncConfig {
    /**
     * How to handle existing entries during push.
     * - 'skip': Only create new entries, never update existing
     * - 'update': Create new entries and update existing ones
     * @default 'skip'
     */
    existingEntries?: 'skip' | 'update';
}
/**
 * Deploy command configuration for automated deployment workflow.
 *
 * The deploy command automates the full deploy workflow:
 * 1. Run verification (if configured)
 * 2. Generate prebuild cache
 * 3. Commit cache changes
 * 4. Push to remote
 */
export interface DeployConfig {
    /**
     * Command to run for verification before deploy.
     * If not set, verification step is skipped with a warning.
     * @example 'pnpm verify'
     */
    verifyCommand?: string;
    /**
     * Directory where prebuild cache is output.
     * @default '.riverbank-cache'
     */
    prebuildOutput?: string;
}
/**
 * Top-level SDK site configuration.
 *
 * This is the complete configuration that SDK sites define in their
 * `riverbank.config.ts` file and use it via the SDK CLI.
 *
 * @example
 * ```typescript
 * // riverbank.config.ts
 * import { defineConfig } from '@riverbankcms/sdk/config';
 *
 * export default defineConfig({
 *   siteId: '123e4567-e89b-12d3-a456-426614174000',
 *   theme: {
 *     palette: {
 *       primary: '#6d28d9',
 *       secondary: '#4c1d95',
 *       accent: '#FF007F',
 *       highlight: '#facc15',
 *     },
 *   },
 *   styles: {
 *     sectionBackgrounds: [
 *       { id: 'primary', label: 'Purple', token: 'primary' },
 *       { id: 'accent', label: 'Pink', token: 'accent' },
 *     ],
 *     sectionOptions: {
 *       backgroundColor: true,
 *       backgroundImage: false,
 *       spacing: ['compact', 'default', 'spacious'],
 *     },
 *   },
 *   blockFieldOptions: {
 *     'block.embed': {
 *       layout: {
 *         options: [
 *           { value: 'showcase', label: 'Showcase Grid' },
 *           { value: 'list', label: 'Simple List' },
 *         ]
 *       }
 *     }
 *   },
 * });
 * ```
 */
export interface RiverbankSiteConfig {
    /** Site UUID from the dashboard - identifies which site this config belongs to */
    siteId: string;
    /**
     * Preview URL for this SDK site.
     * Used by dashboard preview buttons to open the site's preview/staging environment.
     * If not provided, preview buttons will be hidden for SDK sites.
     * @example 'https://staging.mysite.com'
     */
    previewUrl?: string;
    /**
     * Live/production URL for this SDK site.
     * Used by "View live site" links in the dashboard.
     * If not provided, live site links will be hidden for SDK sites.
     * @example 'https://mysite.com'
     */
    liveUrl?: string;
    /** SDK-defined theme with color palette for token resolution */
    theme?: SdkThemeConfig;
    /** Style configuration for curating editor options */
    styles?: SiteStyleConfig;
    /**
     * Layout-level configuration.
     *
     * These blocks are SDK-managed (source controlled) and synced to the CMS via
     * `riverbankcms push-config`.
     */
    layout?: {
        /**
         * Global footer blocks list (applies to all pages).
         *
         * These are block instances, not persisted CMS page blocks.
         */
        footerBlocks?: Array<{
            /**
             * Optional stable identifier for list rendering.
             * Not a CMS block UUID.
             */
            id?: string;
            /** Block kind (system: block.* or custom: custom.*) */
            kind: string;
            /** Static content payload for the block */
            content?: Record<string, unknown>;
        }>;
    };
    /**
     * Custom blocks defined by the SDK site.
     * These blocks appear in the block picker and are edited via CMS forms.
     * SDK sites MUST provide blockOverrides for rendering.
     */
    customBlocks?: SdkCustomBlock[];
    /**
     * Per-block field options.
     *
     * Allows SDK sites to define which options are available for specific
     * fields in specific blocks. Widgets with `ui.widget: 'sdkSelect'`
     * will use these options when available, falling back to field defaults.
     *
     * @example
     * ```typescript
     * blockFieldOptions: {
     *   'block.embed': {
     *     layout: {
     *       options: [
     *         { value: 'showcase', label: 'Showcase Grid' },
     *         { value: 'list', label: 'Simple List' },
     *       ]
     *     }
     *   }
     * }
     * ```
     */
    blockFieldOptions?: BlockFieldOptionsMap;
    /**
     * Per-block field extensions.
     *
     * Allows SDK sites to add custom fields to built-in block types.
     * Extended fields appear at the end of the block's editing form
     * and their values are accessible in `blockOverrides` via the `content` prop.
     *
     * Note: Extended field IDs must not conflict with existing block fields.
     * Required fields must have a `defaultValue` to support existing blocks.
     *
     * @example
     * ```typescript
     * blockFieldExtensions: {
     *   'block.body-text': {
     *     fields: [
     *       {
     *         id: 'layout',
     *         type: 'select',
     *         label: 'Layout',
     *         options: [
     *           { value: 'default', label: 'Default' },
     *           { value: 'wide', label: 'Wide' },
     *         ],
     *         defaultValue: 'default',
     *       },
     *     ],
     *   },
     * }
     * ```
     */
    blockFieldExtensions?: BlockFieldExtensionsMap;
    /**
     * SDK-declared editor workflows.
     *
     * V1 supports manual content-entry and page workflows. The dashboard treats
     * this config as the source of truth and shows matching actions in the editor.
     */
    workflows?: SdkWorkflowConfig[];
    /**
     * Content scaffolding configuration.
     *
     * Defines content type schema and optional local content scaffolding.
     * `riverbankcms push-config` syncs schema/config surfaces such as
     * content type definitions. Pages, entries, and navigation menus are
     * mutable content documents; sync them with explicit `riverbankcms push`
     * scopes.
     *
     * @example
     * ```typescript
     * content: {
     *   contentTypes: [...],
     *   pages: [...],
     *   entries: [...],
     *   navigationMenus: [...],
     *   settings: { homepagePath: '/' },
     * }
     * ```
     */
    content?: ContentConfig;
    /**
     * Content directory path for CLI operations.
     *
     * When using `riverbankcms push` or `riverbankcms pull`, content is
     * read from or written to this directory. JSON files in this directory
     * are the source of truth for content.
     *
     * @default './content'
     * @example './src/content'
     */
    contentDir?: string;
    /**
     * Sync behavior configuration for CLI push operations.
     *
     * Controls how the SDK CLI handles content synchronization when
     * pushing content from local files to the CMS.
     * Status (draft/published) is synced based on local file status.
     *
     * @example
     * ```typescript
     * sync: {
     *   existingEntries: 'update',  // Update existing entries
     * }
     * ```
     */
    sync?: SyncConfig;
    /**
     * Deploy command configuration.
     *
     * Configures the `riverbankcms deploy` command behavior for
     * automated deployments with prebuild cache generation.
     *
     * @example
     * ```typescript
     * deploy: {
     *   verifyCommand: 'pnpm verify',
     *   prebuildOutput: '.riverbank-cache',
     * }
     * ```
     */
    deploy?: DeployConfig;
    /**
     * Where SDK site loads theme from.
     * - 'local': Load from content/themes/{activeTheme}.json
     * - 'cms': Fetch from CMS via SDK client (default)
     *
     * When 'local', the SDK site reads theme from the local file system,
     * enabling development without CMS dependency.
     *
     * @default 'cms'
     */
    themeSource?: 'local' | 'cms';
    /**
     * Active theme name for local loading and default push.
     *
     * When `themeSource` is 'local', this specifies which theme file to load
     * from `content/themes/{activeTheme}.json`.
     *
     * When pushing themes with `riverbankcms push theme` without specifying
     * a theme name, this value is used as the default.
     *
     * @default 'current'
     */
    activeTheme?: string;
    /**
     * Enable portal authentication for the reserved `/portal` customer route.
     *
     * When enabled, the SDK reads the portal session token from the httpOnly
     * cookie set by the portal callback route.
     *
     * Requires setting up portal auth routes in your app:
     * - `/api/portal/callback` using `handlePortalCallback()`
     * - `/api/portal/logout` using `handlePortalLogout()`
     *
     * @default false
     */
    enablePortal?: boolean;
    /**
     * Dashboard configuration for CMS UI behavior.
     *
     * This is stored in `sites.sdk_config` and can be pushed via the SDK CLI.
     * It allows per-site customization of what the dashboard shows (navigation,
     * experimental features, etc.).
     */
    dashboard?: DashboardConfig;
}
export interface DashboardConfig {
    /**
     * Enable token-based Preview Mode redirects for SDK preview URLs.
     *
     * When true, dashboard preview links append the user's short-lived Supabase session tokens to the
     * site's `previewUrl`. SDK middleware captures those tokens into httpOnly cookies and loads the
     * editable preview shell on the external host.
     *
     * @default false
     */
    previewEditingEnabled?: boolean;
    navigation?: DashboardNavigationConfig;
}
export type SdkWorkflowTrigger = {
    type: 'manual';
};
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 interface DashboardNavigationConfig {
    /**
     * Top-level site navigation (Overview/Content/Media/Settings/etc.)
     */
    siteNav?: DashboardNavVisibilityConfigWithRoles;
    /**
     * Site settings sidebar navigation (General/Domains/Emails/etc.)
     */
    settingsNav?: DashboardNavVisibilityConfigWithRoles;
}
export type DashboardSiteRole = 'administrator' | 'editor' | 'event_host' | 'team_member';
export interface DashboardNavVisibilityConfig {
    /**
     * How `allowIds` should be interpreted.
     * - 'augment' (default): allowIds can turn on non-GA items, but does not hide other items.
     * - 'restrict': when allowIds is non-empty, only allowIds are shown (denyIds still wins).
     */
    mode?: 'augment' | 'restrict';
    /**
     * Optional allowlist of nav IDs.
     *
     * - In 'augment' mode (default), these IDs are force-enabled (useful for internal/beta items).
     * - In 'restrict' mode, these IDs become the only items shown (when non-empty).
     */
    allowIds?: string[];
    /**
     * Optional denylist of nav IDs. Deny always wins.
     */
    denyIds?: string[];
}
export interface DashboardNavVisibilityConfigWithRoles extends DashboardNavVisibilityConfig {
    /**
     * Optional per-role overrides for dashboard collaborators.
     * Owner is intentionally excluded (owners see everything).
     */
    roles?: Partial<Record<DashboardSiteRole, DashboardNavVisibilityConfig>>;
}
