import { ForwardRefExoticComponent } from 'react';
import { RefAttributes } from 'react';

/**
 * ReactQRCode props.
 */
export declare type BackgroundSettings = string | GradientSettings;

export declare type CrossOrigin = 'anonymous' | 'use-credentials' | '' | undefined;

export declare interface DataModulesSettings {
    color?: string;
    style?: DataModulesStyle;
    randomSize?: boolean;
}

export declare type DataModulesStyle = 'square' | 'square-sm' | 'pinched-square' | 'rounded' | 'leaf' | 'vertical-line' | 'horizontal-line' | 'circle' | 'diamond' | 'star' | 'heart' | 'hashtag';

export declare type DownloadFileFormat = 'svg' | 'png' | 'jpeg';

export declare interface DownloadOptions {
    name?: string;
    format?: DownloadFileFormat;
    size?: number;
}

export declare type ERROR_LEVEL_MAPPED_TYPE = {
    [index in ErrorCorrectionLevel]: qrcodegen.QrCode.Ecc;
};

export declare type ErrorCorrectionLevel = 'L' | 'M' | 'Q' | 'H';

export declare type Excavation = {
    x: number;
    y: number;
    w: number;
    h: number;
};

export declare interface FinderPatternInnerSettings {
    color?: string;
    style?: FinderPatternInnerStyle;
}

export declare type FinderPatternInnerStyle = 'square' | 'pinched-square' | 'rounded-sm' | 'rounded' | 'rounded-lg' | 'circle' | 'inpoint-sm' | 'inpoint' | 'inpoint-lg' | 'outpoint-sm' | 'outpoint' | 'outpoint-lg' | 'leaf-sm' | 'leaf' | 'leaf-lg' | 'diamond' | 'star' | 'heart' | 'hashtag';

export declare interface FinderPatternOuterSettings {
    color?: string;
    style?: FinderPatternOuterStyle;
}

export declare type FinderPatternOuterStyle = 'square' | 'pinched-square' | 'rounded-sm' | 'rounded' | 'rounded-lg' | 'circle' | 'inpoint-sm' | 'inpoint' | 'inpoint-lg' | 'outpoint-sm' | 'outpoint' | 'outpoint-lg' | 'leaf-sm' | 'leaf' | 'leaf-lg';

export declare interface GradientSettings {
    type: GradientSettingsType;
    stops: GradientSettingsStop[];
    rotation?: number;
}

export declare interface GradientSettingsStop {
    offset: string;
    color: string;
}

export declare type GradientSettingsType = 'linear' | 'radial';

/**
 * Image settings for the QR Code.
 */
export declare interface ImageSettings {
    /**
     * The URI of the embedded image.
     */
    src: string;
    /**
     * The height, in pixels, of the image.
     */
    height: number;
    /**
     * The width, in pixels, of the image.
     */
    width: number;
    /**
     * Whether or not to "excavate" the modules around the embedded image. This
     * means that any modules the embedded image overlaps will use the background
     * color.
     */
    excavate?: boolean;
    /**
     * The horiztonal offset of the embedded image, starting from the top left corner.
     * Will center if not specified.
     */
    x?: number;
    /**
     * The vertical offset of the embedded image, starting from the top left corner.
     * Will center if not specified.
     */
    y?: number;
    /**
     * The opacity of the embedded image in the range of 0-1.
     * @defaultValue 1
     */
    opacity?: number;
    /**
     * The cross-origin value to use when loading the image. This is used to
     * ensure compatibility with CORS, particularly when extracting image data
     * from QRCodeCanvas.
     * Note: `undefined` is treated differently than the seemingly equivalent
     * empty string. This is intended to align with HTML behavior where omitting
     * the attribute behaves differently than the empty string.
     */
    crossOrigin?: CrossOrigin;
}

/**
 * qrcodegen
 */
export declare type Modules = ReturnType<qrcodegen.QrCode['getModules']>;

/**
 * @license QR Code generator library (TypeScript)
 * Copyright (c) Project Nayuki.
 * SPDX-License-Identifier: MIT
 */
declare namespace qrcodegen {
    type bit = number;
    type byte = number;
    type int = number;
    class QrCode {
        readonly version: int;
        readonly errorCorrectionLevel: QrCode.Ecc;
        static encodeText(text: string, ecl: QrCode.Ecc): QrCode;
        static encodeBinary(data: Readonly<Array<byte>>, ecl: QrCode.Ecc): QrCode;
        static encodeSegments(segs: Readonly<Array<QrSegment>>, ecl: QrCode.Ecc, minVersion?: int, maxVersion?: int, mask?: int, boostEcl?: boolean): QrCode;
        readonly size: int;
        readonly mask: int;
        private readonly modules;
        private readonly isFunction;
        constructor(version: int, errorCorrectionLevel: QrCode.Ecc, dataCodewords: Readonly<Array<byte>>, msk: int);
        getModule(x: int, y: int): boolean;
        getModules(): boolean[][];
        private drawFunctionPatterns;
        private drawFormatBits;
        private drawVersion;
        private drawFinderPattern;
        private drawAlignmentPattern;
        private setFunctionModule;
        private addEccAndInterleave;
        private drawCodewords;
        private applyMask;
        private getPenaltyScore;
        private getAlignmentPatternPositions;
        private static getNumRawDataModules;
        private static getNumDataCodewords;
        private static reedSolomonComputeDivisor;
        private static reedSolomonComputeRemainder;
        private static reedSolomonMultiply;
        private finderPenaltyCountPatterns;
        private finderPenaltyTerminateAndCount;
        private finderPenaltyAddHistory;
        static readonly MIN_VERSION: int;
        static readonly MAX_VERSION: int;
        private static readonly PENALTY_N1;
        private static readonly PENALTY_N2;
        private static readonly PENALTY_N3;
        private static readonly PENALTY_N4;
        private static readonly ECC_CODEWORDS_PER_BLOCK;
        private static readonly NUM_ERROR_CORRECTION_BLOCKS;
    }
    class QrSegment {
        readonly mode: QrSegment.Mode;
        readonly numChars: int;
        private readonly bitData;
        static makeBytes(data: Readonly<Array<byte>>): QrSegment;
        static makeNumeric(digits: string): QrSegment;
        static makeAlphanumeric(text: string): QrSegment;
        static makeSegments(text: string): Array<QrSegment>;
        static makeEci(assignVal: int): QrSegment;
        static isNumeric(text: string): boolean;
        static isAlphanumeric(text: string): boolean;
        constructor(mode: QrSegment.Mode, numChars: int, bitData: Array<bit>);
        getData(): Array<bit>;
        static getTotalBits(segs: Readonly<Array<QrSegment>>, version: int): number;
        private static toUtf8ByteArray;
        private static readonly NUMERIC_REGEX;
        private static readonly ALPHANUMERIC_REGEX;
        private static readonly ALPHANUMERIC_CHARSET;
    }
        {};
}

declare namespace qrcodegen.QrCode {
    type int = number;
    class Ecc {
        readonly ordinal: int;
        readonly formatBits: int;
        static readonly LOW: Ecc;
        static readonly MEDIUM: Ecc;
        static readonly QUARTILE: Ecc;
        static readonly HIGH: Ecc;
        private constructor();
    }
        {};
}

declare namespace qrcodegen.QrSegment {
    type int = number;
    class Mode {
        readonly modeBits: int;
        private readonly numBitsCharCount;
        static readonly NUMERIC: Mode;
        static readonly ALPHANUMERIC: Mode;
        static readonly BYTE: Mode;
        static readonly KANJI: Mode;
        static readonly ECI: Mode;
        private constructor();
        numCharCountBits(ver: int): int;
    }
        {};
}

export declare const ReactQRCode: ForwardRefExoticComponent<Omit<ReactQRCodeProps, "ref"> & RefAttributes<ReactQRCodeRef>>;

export declare interface ReactQRCodeProps {
    ref?: React.Ref<ReactQRCodeRef>;
    /**
     * The value to encode into the QR Code. An array of strings can be passed in
     * to represent multiple segments to further optimize the QR Code.
     */
    value: string | string[];
    /**
     * The size, in pixels, to render the QR Code.
     * @defaultValue 128
     */
    size?: number;
    /**
     * The Error Correction Level to use.
     * @see https://www.qrcode.com/en/about/error_correction.html
     * @defaultValue L
     */
    level?: ErrorCorrectionLevel;
    /**
     * The number of _modules_ to use for margin. The QR Code specification
     * requires `4`, however you can specify any number. Values will be turned to
     * integers with `Math.floor`.
     * @defaultValue 0
     */
    marginSize?: number;
    /**
     * The minimum version used when encoding the QR Code. Valid values are 1-40
     * with higher values resulting in more complex QR Codes. The optimal
     * (lowest) version is determined for the `value` provided, using `minVersion`
     * as the lower bound.
     * @defaultValue 1
     */
    minVersion?: number;
    /**
     * If enabled, the Error Correction Level of the result may be higher than
     * the specified Error Correction Level option if it can be done without
     * increasing the version.
     * @defaultValue true
     */
    boostLevel?: boolean;
    /**
     * The QR code background either a hex color or GradientSettings.
     * @defaultValue #FFFFFF
     */
    background?: BackgroundSettings;
    /**
     * The gradient settings applied to the qr code data modules and finder patterns.
     */
    gradient?: GradientSettings;
    /**
     * The settings for the data modules.
     */
    dataModulesSettings?: DataModulesSettings;
    /**
     * The settings for the finder pattern outer modules.
     */
    finderPatternOuterSettings?: FinderPatternOuterSettings;
    /**
     * The settings for the finder pattern outer modules.
     */
    finderPatternInnerSettings?: FinderPatternInnerSettings;
    /**
     * The settings for the embedded image.
     */
    imageSettings?: ImageSettings;
    /**
     * Optional props to pass to the SVG element.
     */
    svgProps?: React.SVGProps<SVGSVGElement>;
}

export declare interface ReactQRCodeRef {
    svg: SVGSVGElement | null;
    download: (options: DownloadOptions) => void;
}

export { }
