interface Ssr {
    id?: string
    path: string
    content: string
    // validUntil: any // go Time
}

interface ApiOptions {
    method?: "GET" | "POST" | "PUT" | "DELETE"
    filter?: any
    sort?: string
    lookup?: string
    limit?: number
    offset?: number
    projection?: string
    headers?: {
        [key: string]: string
    }
    params?: {
        [key: string]: string
    }
    signal?: AbortSignal
}

interface LocationStore {
    path: string
    search: string
    hash: string
    push: boolean
    pop: boolean
    previousLocation?: LocationStore
}

interface ApiResult<T> {
    data: T
    count: number
    /** Build timestamp from server (X-Build-Time header), only present on client requests */
    buildTime?: string | null
}

interface FileField {
    path: string
    src: string
    type: string
    size: number
}

interface MedialibEntry {
    id?: string
    file?: {
        src?: string
        type?: string
    }
    alt?: string
    [key: string]: unknown
}

/** Pagebuilder: Content Block Entry */
interface ContentBlockEntry {
    hide?: boolean
    headline?: string
    headlineH1?: boolean
    subline?: string
    tagline?: string
    anchorId?: string
    containerWidth?: "" | "wide" | "full"
    background?: {
        color?: string
        image?: string
    }
    padding?: {
        top?: string
        bottom?: string
    }
    type?: string
    callToAction?: {
        buttonText?: string
        buttonLink?: string
        buttonTarget?: string
    }
    heroImage?: {
        image?: string
    }
    // richtext fields
    text?: string
    imagePosition?: "none" | "left" | "right"
    imageRounded?: string
    image?: string
    // accordion fields
    accordionItems?: {
        question?: string
        answer?: string
        open?: boolean
    }[]
    // imageGallery fields
    imageGallery?: {
        images?: {
            image?: string
            caption?: string
            showCaption?: boolean
        }[]
    }
    // richtext caption fields
    showImageCaption?: boolean
    imageCaption?: string
}

/** Content Entry from the CMS */
interface ContentEntry {
    id?: string
    _id?: string
    active?: boolean
    publication?: {
        from?: string | Date
        to?: string | Date
    }
    type?: string
    lang?: string
    translationKey?: string
    name?: string
    path?: string
    alternativePaths?: { path?: string }[]
    thumbnail?: string
    teaserText?: string
    blocks?: ContentBlockEntry[]
    meta?: {
        title?: string
        description?: string
        keywords?: string
    }
}

/** Navigation element */
interface NavigationElement {
    name: string
    external?: boolean
    page?: string
    hash?: string
    externalUrl?: string
}

/** Navigation entry from the CMS */
interface NavigationEntry {
    id?: string
    _id?: string
    language?: string
    type?: "header" | "footer"
    elements?: NavigationElement[]
}

interface ProductEntry {
    id: string
    // ...
}
