/**
 * consents.ts
 * CleanInsightsSDK
 *
 * Created by Benjamin Erhart on 19.01.21.
 * Copyright © 2021 Guardian Project. All rights reserved.
 */
export { Feature, ConsentState, Consent, Consents, ConsentsData, ConsentData, ConsentsMap, FeatureConsent, CampaignConsent };
import { Campaign } from "./Campaign";
import dayjs from 'dayjs';
declare enum Feature {
    lang = "lang",
    ua = "ua"
}
declare enum ConsentState {
    /**
     A campaign with that ID doesn't exist or already expired.
     */
    unconfigured = "unconfigured",
    /**
     There's no record of consent. User was probably never asked.
     */
    unknown = "unknown",
    /**
     User denied consent. Don't ask again!
     */
    denied = "denied",
    /**
     Consent was given, but consent period has not yet started.
     */
    notStarted = "notStarted",
    /**
     Consent was given, but consent period is over. You might ask again for a new period.
     */
    expired = "expired",
    /**
     Consent was given and is currently valid.
     */
    granted = "granted"
}
interface ConsentData {
    granted: boolean;
    start: string | dayjs.Dayjs;
    end: string | dayjs.Dayjs;
}
declare class Consent {
    granted: boolean;
    start: dayjs.Dayjs;
    end: dayjs.Dayjs;
    /**
     * @param {boolean|ConsentData} granted
     * @param {dayjs.Dayjs=} start=NOW
     * @param {dayjs.Dayjs=} end=NOW
     */
    constructor(granted: boolean | ConsentData, start?: dayjs.Dayjs, end?: dayjs.Dayjs);
    get state(): ConsentState;
}
declare class FeatureConsent extends Consent {
    feature: Feature | string;
    /**
     * @param {Feature|string} feature
     * @param {Consent} consent
     */
    constructor(feature: Feature | string, consent: Consent);
}
declare class CampaignConsent extends Consent {
    campaignId: string;
    /**
     * @param {string} campaignId
     * @param {Consent} consent
     */
    constructor(campaignId: string, consent: Consent);
    get state(): ConsentState;
}
interface ConsentsMap {
    [key: string]: Consent | ConsentData;
}
interface ConsentsData {
    features: ConsentsMap;
    campaigns: ConsentsMap;
}
/**
 * This class keeps track of all granted or denied consents of a user.
 *
 * There are two different types of consents:
 * - Consents for common features like if we're allowed to evaluate the locale or a user agent.
 * - Consents per measurement campaign.
 *
 * The time of the consent is recorded along with its state: If it was actually granted or denied.
 *
 * Consents for common features are given indefinitely, since they are only ever recorded along
 * with running campaigns.
 *
 * Consents for campaigns only last for a certain amount of days.
 */
declare class Consents {
    features: {
        [key: string]: Consent;
    };
    campaigns: {
        [key: string]: Consent;
    };
    /**
     *
     * @param {Object=}json Optional data from JSON deserialization to assign.
     */
    constructor(json?: {
        features: ConsentsMap;
        campaigns: ConsentsMap;
    });
    /**
     * User consents to evaluate a `Feature`.
     *
     * @param {Feature} feature
     * @returns {FeatureConsent}
     */
    grantFeature(feature: Feature): FeatureConsent;
    /**
     * User denies consent to evaluate a `Feature`.
     *
     * @param {Feature} feature
     * @returns {FeatureConsent}
     */
    denyFeature(feature: Feature): FeatureConsent;
    /**
     * Returns the consent for a given feature, if any available.
     *
     * @param {Feature|string} feature The feature to get the consent for.
     * @returns {?FeatureConsent} the `FeatureConsent` for the given feature or `null`, if consent unknown.
     */
    consentForFeature(feature: Feature | string): FeatureConsent | null;
    /**
     * Checks the consent state of a feature.
     *
     * @param {Feature} feature The feature to check the consent state of.
     * @returns {ConsentState} the current state of consent.
     */
    stateOfFeature(feature: Feature): ConsentState;
    /**
     * User consents to run a specific campaign.
     *
     * @param {string} campaignId
     *      The campaign ID.
     * @param {Campaign} campaign
     *      The campaign.
     * @returns {CampaignConsent}
     */
    grantCampaign(campaignId: string, campaign: Campaign): CampaignConsent;
    /**
     * User denies consent to run a specific campaign.
     *
     * @param {string} campaignId
     * @returns {CampaignConsent}
     */
    denyCampaign(campaignId: string): CampaignConsent;
    /**
     * Returns the consent for a given campaign, if any available.
     *
     * @param {string} campaignId The campaign ID to get the consent for.
     * @returns {?CampaignConsent} the `CampaignConsent` for the given campaign or `null`, if consent unknown.
     */
    consentForCampaign(campaignId: string): CampaignConsent | null;
    /**
     * Checks the consent state of a campaign.
     *
     * @param {string} campaignId The campaign ID to check the consent state of.
     * @returns {ConsentState} the current state of consent.
     */
    stateOfCampaign(campaignId: string): ConsentState;
}
