import { z } from 'zod';
import * as _accelbyte_sdk_legal from '@accelbyte/sdk-legal';
import { PolicyVersionWithLocalizedVersionObject, RetrievePolicyPublicResponse, RetrievePolicyPublicResponseArray } from '@accelbyte/sdk-legal';
import { SingleValue } from 'react-select';
import { marked } from 'marked';
import { AccelbyteSDK } from '@accelbyte/sdk';

declare type PolicyVersion = PolicyVersionWithLocalizedVersionObject;
declare type Policy = RetrievePolicyPublicResponse;
declare type PolicyList = RetrievePolicyPublicResponseArray;
interface PolicyStateHierarchy {
    [language: string]: {
        [namespace: string]: {
            [policyId: string]: LocalizedPolicyWithParentInfo;
        };
    };
}
declare const LocalizedPolicyWithParentInfo: z.ZodObject<z.extendShape<{
    attachmentChecksum: z.ZodNullable<z.ZodOptional<z.ZodString>>;
    attachmentLocation: z.ZodNullable<z.ZodOptional<z.ZodString>>;
    attachmentVersionIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
    contentType: z.ZodNullable<z.ZodOptional<z.ZodString>>;
    createdAt: z.ZodNullable<z.ZodOptional<z.ZodString>>;
    description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
    id: z.ZodString;
    isDefaultSelection: z.ZodBoolean;
    localeCode: z.ZodString;
    publishedDate: z.ZodNullable<z.ZodOptional<z.ZodString>>;
    status: z.ZodNullable<z.ZodOptional<z.ZodString>>;
    updatedAt: z.ZodNullable<z.ZodOptional<z.ZodString>>;
}, {
    parentId: z.ZodString;
    parentNamespace: z.ZodString;
    parentCountry: z.ZodString;
    parentName: z.ZodString;
}>, "strip", z.ZodTypeAny, {
    status?: string | null | undefined;
    updatedAt?: string | null | undefined;
    description?: string | null | undefined;
    createdAt?: string | null | undefined;
    contentType?: string | null | undefined;
    attachmentLocation?: string | null | undefined;
    attachmentChecksum?: string | null | undefined;
    attachmentVersionIdentifier?: string | null | undefined;
    publishedDate?: string | null | undefined;
    id: string;
    parentNamespace: string;
    localeCode: string;
    isDefaultSelection: boolean;
    parentId: string;
    parentCountry: string;
    parentName: string;
}, {
    status?: string | null | undefined;
    updatedAt?: string | null | undefined;
    description?: string | null | undefined;
    createdAt?: string | null | undefined;
    contentType?: string | null | undefined;
    attachmentLocation?: string | null | undefined;
    attachmentChecksum?: string | null | undefined;
    attachmentVersionIdentifier?: string | null | undefined;
    publishedDate?: string | null | undefined;
    id: string;
    parentNamespace: string;
    localeCode: string;
    isDefaultSelection: boolean;
    parentId: string;
    parentCountry: string;
    parentName: string;
}>;
interface LocalizedPolicyWithParentInfo extends z.infer<typeof LocalizedPolicyWithParentInfo> {
}

interface LegalDocumentWidgetProps {
    htmlString?: string;
    localizedPolicy?: LocalizedPolicyWithParentInfo;
}
declare function LegalDocumentWidget({ htmlString, localizedPolicy }: LegalDocumentWidgetProps): JSX.Element;

interface LegalDocumentErrorWidgetProps {
    error?: Error;
}
declare function LegalDocumentErrorWidget({ error }: LegalDocumentErrorWidgetProps): JSX.Element;

interface SelectOption {
    label: string;
    value: string;
}

interface LegalDocumentFilterWidgetProps {
    countrySelectOptions?: SelectOption[];
    countrySelectValue?: SelectOption;
    languageSelectOptions?: SelectOption[];
    languageSelectValue?: SelectOption;
    onChangeCountry?: (country: SingleValue<SelectOption>) => void;
    onChangeLanguage?: (language: SingleValue<SelectOption>) => void;
}
declare function LegalDocumentFilterWidget({ countrySelectOptions, countrySelectValue, languageSelectOptions, languageSelectValue, onChangeCountry, onChangeLanguage }: LegalDocumentFilterWidgetProps): JSX.Element;

declare class NoPolicyDataFound extends Error {
    constructor(m?: string);
}

interface LegalDocumentFilterAccordionWidgetProps {
    groupedPolicies?: PolicyStateHierarchy;
    localizedPolicy?: LocalizedPolicyWithParentInfo;
    onClickPolicy?: (localizedPolicy: LocalizedPolicyWithParentInfo) => void;
}
declare function LegalDocumentFilterAccordionWidget({ groupedPolicies, localizedPolicy, onClickPolicy }: LegalDocumentFilterAccordionWidgetProps): JSX.Element;
interface LegalDocumentFilterPolicyProps {
    active: boolean;
    localizedPolicy: LocalizedPolicyWithParentInfo;
    onClickPolicy?: (localizedPolicy: LocalizedPolicyWithParentInfo) => void;
}
declare function LegalDocumentFilterPolicy({ active, localizedPolicy, onClickPolicy }: LegalDocumentFilterPolicyProps): JSX.Element;

interface LegalDocumentFilterWIthAccordionWidgetProps {
    localizedPolicy?: LocalizedPolicyWithParentInfo;
    groupedPolicies?: PolicyStateHierarchy;
    onClickPolicy?: LegalDocumentFilterAccordionWidgetProps['onClickPolicy'];
    countrySelectOptions?: LegalDocumentFilterWidgetProps['countrySelectOptions'];
    countrySelectValue?: LegalDocumentFilterWidgetProps['countrySelectValue'];
    languageSelectOptions?: LegalDocumentFilterWidgetProps['languageSelectOptions'];
    languageSelectValue?: LegalDocumentFilterWidgetProps['languageSelectValue'];
    onChangeCountry?: LegalDocumentFilterWidgetProps['onChangeCountry'];
    onChangeLanguage?: LegalDocumentFilterWidgetProps['onChangeLanguage'];
}
declare function LegalDocumentFilterWIthAccordionWidget({ localizedPolicy, groupedPolicies, onClickPolicy, countrySelectOptions, countrySelectValue, languageSelectOptions, languageSelectValue, onChangeCountry, onChangeLanguage }: LegalDocumentFilterWIthAccordionWidgetProps): JSX.Element;

/*!
 * Copyright (c) 2023 AccelByte Inc. All Rights Reserved
 * This is licensed software from AccelByte Inc, for limitations
 * and restrictions contact your company contract manager.
 */

interface LegalDocumentNavigationWidgetProps {
    headings: marked.Tokens.Heading[];
}
declare function LegalDocumentNavigationWidget({ headings }: LegalDocumentNavigationWidgetProps): JSX.Element;

interface LegalDocumentWIthNavigationWidgetProps {
    htmlString?: string;
    localizedPolicy?: LocalizedPolicyWithParentInfo;
    hideNavigation?: boolean;
}
declare function LegalDocumentWithNavigationWidget({ htmlString, localizedPolicy, hideNavigation }: LegalDocumentWIthNavigationWidgetProps): JSX.Element;

interface LegalPageWidgetProps {
    htmlString?: string;
    localizedPolicy?: LocalizedPolicyWithParentInfo;
    groupedPolicies?: PolicyStateHierarchy;
    onClickPolicy?: LegalDocumentFilterAccordionWidgetProps['onClickPolicy'];
    countrySelectOptions?: LegalDocumentFilterWidgetProps['countrySelectOptions'];
    countrySelectValue?: LegalDocumentFilterWidgetProps['countrySelectValue'];
    languageSelectOptions?: LegalDocumentFilterWidgetProps['languageSelectOptions'];
    languageSelectValue?: LegalDocumentFilterWidgetProps['languageSelectValue'];
    onChangeCountry?: LegalDocumentFilterWidgetProps['onChangeCountry'];
    onChangeLanguage?: LegalDocumentFilterWidgetProps['onChangeLanguage'];
    error?: Error;
}
declare function LegalPageWidget({ htmlString, localizedPolicy, groupedPolicies, onClickPolicy, countrySelectOptions, countrySelectValue, languageSelectOptions, languageSelectValue, onChangeCountry, onChangeLanguage, error }: LegalPageWidgetProps): JSX.Element;

/*!
 * Copyright (c) 2023 AccelByte Inc. All Rights Reserved
 * This is licensed software from AccelByte Inc, for limitations
 * and restrictions contact your company contract manager.
 */

declare function LegalPageTitleWidget(): JSX.Element;

interface BaseFetcherProps {
    sdk: AccelbyteSDK;
}

interface countryOptionsFetcherProps extends BaseFetcherProps {
}
declare function countryOptionsFetcher({ sdk }: countryOptionsFetcherProps): Promise<{
    label: string;
    value: string;
}[]>;

interface languageOptionsFetcherProps extends BaseFetcherProps {
    /**
     * This props is for filtering languages based on available language.
     * For example, after fetching all policies by country, we then can process
     * this policies using `processPolicyInformation` where all the keys inside
     * `groupedPolicies` properties is the available languages.
     *
     * ```
     * const policies = Legal.PoliciesApi(sdk).getPolicyCountry_ByCountryCode(countryCode)
     * const processedPolicies = processPolicyInformation(policies)
     * const availableLanguages = Object.keys(processedPolicies.groupedPolicies)
     * ```
     */
    availableLanguages?: string[];
}
declare function languageOptionsFetcher({ sdk, availableLanguages }: languageOptionsFetcherProps): Promise<{
    label: string;
    value: string;
}[]>;

declare function legalDocumentFetcher(documentLocation: string): Promise<string>;

interface legalPoliciesFetcherProps extends BaseFetcherProps {
    countryCode: string;
    localizedPolicyId?: string;
}
declare function legalPoliciesFetcher({ sdk, countryCode, localizedPolicyId }: legalPoliciesFetcherProps): Promise<{
    policies: _accelbyte_sdk_legal.RetrievePolicyPublicResponseArray;
    groupedPolicies: PolicyStateHierarchy;
    activeLocalizedPolicy: LocalizedPolicyWithParentInfo | undefined;
    firstLanguageCode: string;
    firstPolicyId: string | undefined;
}>;

interface LegalwidgetFetcherProps extends BaseFetcherProps {
    countryCode?: string;
    localizedPolicyId?: string;
    languageCode?: string;
}
declare function legalwidgetFetcher({ sdk, localizedPolicyId, countryCode: cc, languageCode: lc }: LegalwidgetFetcherProps): Promise<{
    policies: _accelbyte_sdk_legal.RetrievePolicyPublicResponseArray;
    document: string;
    countryOptions: {
        label: string;
        value: string;
    }[];
    languageOptions: {
        label: string;
        value: string;
    }[];
    selectedCountry: {
        label: string;
        value: string;
    } | undefined;
    selectedLanguage: {
        label: string;
        value: string;
    } | undefined;
    groupedPolicies: PolicyStateHierarchy;
    activeLocalizedPolicy: LocalizedPolicyWithParentInfo | undefined;
}>;

interface localizedPolicyFetcherProps extends BaseFetcherProps {
    localizedPolicyId: string;
}
declare function localizedPolicyFetcher({ sdk, localizedPolicyId }: localizedPolicyFetcherProps): Promise<_accelbyte_sdk_legal.RetrieveLocalizedPolicyVersionPublicResponse>;

declare const DOCUMENT_HEADER_PREFIX = "section-";
declare const HEADING_LEVEL_DEPTH_TO_DISPLAY = 2;
declare enum contentType {
    'html' = "text/html",
    'markdown' = "text/markdown"
}
declare const SUPPORTED_FILE_TYPE: contentType[];
declare function sanitizeHTML(document: string): string | HTMLElement | DocumentFragment;
declare function generateHtmlFromMd(document: string): string;
declare function generateHeadingFromMd(document: string): {
    depth: number;
    type: "heading";
    raw: string;
    text: string;
    tokens: marked.Token[];
}[];

declare function getSelectedOptions(options: {
    label: string;
    value: string;
}[], selectedValue?: string): {
    label: string;
    value: string;
} | undefined;

declare function processPolicyInformation(policies: PolicyList, localizedPolicyId?: string): {
    groupedPolicies: PolicyStateHierarchy;
    activeLocalizedPolicy: LocalizedPolicyWithParentInfo | undefined;
};

export { DOCUMENT_HEADER_PREFIX, HEADING_LEVEL_DEPTH_TO_DISPLAY, LegalDocumentErrorWidget, LegalDocumentErrorWidgetProps, LegalDocumentFilterAccordionWidget, LegalDocumentFilterAccordionWidgetProps, LegalDocumentFilterPolicy, LegalDocumentFilterPolicyProps, LegalDocumentFilterWIthAccordionWidget, LegalDocumentFilterWIthAccordionWidgetProps, LegalDocumentFilterWidget, LegalDocumentFilterWidgetProps, LegalDocumentNavigationWidget, LegalDocumentNavigationWidgetProps, LegalDocumentWIthNavigationWidgetProps, LegalDocumentWidget, LegalDocumentWidgetProps, LegalDocumentWithNavigationWidget, LegalPageTitleWidget, LegalPageWidget, LegalPageWidgetProps, LocalizedPolicyWithParentInfo, NoPolicyDataFound, Policy, PolicyList, PolicyStateHierarchy, PolicyVersion, SUPPORTED_FILE_TYPE, contentType, countryOptionsFetcher, generateHeadingFromMd, generateHtmlFromMd, getSelectedOptions, languageOptionsFetcher, legalDocumentFetcher, legalPoliciesFetcher, legalwidgetFetcher, localizedPolicyFetcher, processPolicyInformation, sanitizeHTML };
