import { Params, RouteObject } from 'react-router';
/**
 * Context object passed to data retriever functions during route loading.
 * Contains all necessary information for fetching route-specific data.
 *
 * @property {Params<string>} params - Route parameters extracted from the URL path
 * @property {Request} request - The full HTTP request object
 * @property {URLSearchParams} searchParams - Query string parameters from the URL
 */
export type DataRetrieverContext = {
    params: Params<string>;
    request: Request;
    searchParams: URLSearchParams;
};
/**
 * Function type for data retrievers that fetch business data for a route.
 * Retrievers execute in parallel during route loading and their results are merged.
 *
 * @param {DataRetrieverContext} ctx - Context containing route params, request, and search params
 * @returns {Promise<Record<string, unknown>>} Promise resolving to an object of data to merge into loader result
 */
export type DataRetriever = (ctx: DataRetrieverContext) => Promise<Record<string, unknown>>;
/**
 * SEO metadata type adapted from backend SeoMetaData.
 * Used for client-side head management and serverless rendering meta tag generation.
 * All properties are optional to support partial SEO metadata.
 *
 * @property {string} [title] - Page title for browser title bar and search results
 * @property {string} [description] - Meta description for search engines
 * @property {string[]} [keywords] - Keywords for SEO purposes
 * @property {string} [ogTitle] - Open Graph title for social media sharing
 * @property {string} [ogDescription] - Open Graph description for social media
 * @property {string} [ogImage] - Open Graph image URL for social media previews
 * @property {string} [ogUrl] - Open Graph canonical URL
 * @property {string} [ogType] - Open Graph content type (e.g., 'website', 'article')
 * @property {string} [twitterCard] - Twitter card type (e.g., 'summary', 'summary_large_image')
 * @property {string} [twitterTitle] - Twitter card title
 * @property {string} [twitterDescription] - Twitter card description
 * @property {string} [twitterImage] - Twitter card image URL
 * @property {string} [canonicalUrl] - Canonical URL to prevent duplicate content
 * @property {string} [robots] - Instructions for search engine crawlers (e.g., 'index, follow')
 * @property {Record<string, unknown>} [jsonLd] - JSON-LD structured data for search engines
 */
export type SeoMeta = {
    title?: string;
    description?: string;
    keywords?: string[];
    ogTitle?: string;
    ogDescription?: string;
    ogImage?: string;
    ogUrl?: string;
    ogType?: string;
    twitterCard?: string;
    twitterTitle?: string;
    twitterDescription?: string;
    twitterImage?: string;
    canonicalUrl?: string;
    robots?: string;
    jsonLd?: Record<string, unknown>;
};
/**
 * Internal framework data reserved for Runtime's use.
 * Users cannot override these fields in their data retrievers.
 * Extensible for future framework-level features without breaking changes.
 *
 * @property {SeoMeta} [seoMeta] - SEO metadata loaded by internal SEO retriever
 */
export type RuntimeInternalData = {
    seoMeta?: SeoMeta;
};
/**
 * Structured result object returned by framework-generated loaders.
 * Separates framework-internal data from user business data.
 *
 * @property {RuntimeInternalData} internal - Framework-reserved data (SEO, future features)
 * @property {Record<string, unknown>} business - User data merged from runtimeAsync retrievers
 */
export type RuntimeLoaderResult = {
    internal: RuntimeInternalData;
    business: Record<string, unknown>;
};
/**
 * Route configuration type that extends React Router's RouteObject.
 * Removes direct loader access and adds runtimeAsync for framework-controlled data loading.
 *
 * @property {DataRetriever[]} [runtimeAsync] - Array of data retriever functions for this route
 * @property {RuntimeRoute[]} [children] - Nested child routes
 */
export interface RuntimeRoute extends Omit<RouteObject, 'loader' | 'children'> {
    runtimeAsync?: DataRetriever[];
    children?: RuntimeRoute[];
}
