import * as i0 from '@angular/core';
import * as i1 from '@c8y/ngx-components';
import { HumanizeAppNamePipe, AlertService } from '@c8y/ngx-components';
import * as i2 from '@angular/forms';
import { FormGroup, FormBuilder } from '@angular/forms';
import { IApplication, ApplicationService, TenantService, TenantOptionsService } from '@c8y/client';

/** The list of partial application objects. */
type PartialAppsList = Array<Partial<IApplication>>;
/** The interface for default subscriptions configuration. */
interface DefaultSubscriptions {
    /** Whether the list of on tenant creation subscriptions is overridden in the current tenant. Won't be defined for inherited configuration. */
    overrideOnCreationSubscriptions?: boolean;
    /** The list of applications subscribed to new tenants on creation. */
    onCreationSubscriptions: PartialAppsList;
    /** Whether the list of on platform upgrade subscriptions is overridden in the current tenant. Won't be defined for inherited configuration. */
    overrideOnUpgradeSubscriptions?: boolean;
    /** The list of applications subscribed to existing tenants on platform upgrade. */
    onUpgradeSubscriptions: PartialAppsList;
}
/** The context for evaluating default subscriptions configuration */
declare enum DefaultSubscriptionsContext {
    /** Current tenant context (only current tenant options are taken into account). */
    CURRENT_TENANT = 0,
    /** Parent tenant context (only parent tenant options are taken into account). */
    PARENT_TENANT = 1
}

declare class DefaultSubscriptionsService {
    private applicationService;
    private tenantService;
    private tenantOptionsService;
    private humanizeAppNamePipe;
    constructor(applicationService: ApplicationService, tenantService: TenantService, tenantOptionsService: TenantOptionsService, humanizeAppNamePipe: HumanizeAppNamePipe);
    /**
     * Gets the list of applications which can be used in default subscriptions, i.e.:
     * - current tenant's all own applications,
     * - inherited applications, which do not have the same names as current tenant's own apps.
     * The list is sorted alphabetically by humanized app name and contains up to 2000 items.
     * @returns The list of applications, which can be used in default subscriptions.
     */
    getSubscribableTenantApps(): Promise<IApplication[]>;
    /**
     * Gets the default subscriptions configuration inherited from parent tenant.
     * @returns The default subscriptions object with settings from parent tenant.
     */
    getDefaultSubscriptionsEvaluatedFromParentTenant(): Promise<DefaultSubscriptions>;
    /**
     * Gets the default subscriptions configuration from the current tenant.
     * @returns The default subscriptions object with settings from the current tenant.
     */
    getDefaultSubscriptionsFromCurrentTenant(): Promise<DefaultSubscriptions>;
    /**
     * Saves given default subscriptions configuration to the current tenant
     * (either sets, updates, or deletes corresponding tenant options).
     * @param defaultSubscriptions The default subscriptions configuration to be saved.
     */
    saveDefaultSubscriptionsToCurrentTenant(defaultSubscriptions: DefaultSubscriptions): Promise<void>;
    /**
     * Gets default subscriptions in the context of current or parent tenant.
     * @param contextTenant Tells whether to use current or parent tenant as context.
     */
    private getDefaultSubscriptions;
    private getTenantOptions;
    private saveOnCreationSubscriptions;
    private saveOnUpgradeSubscriptions;
    private getTenantOption;
    private setTenantOption;
    private unsetTenantOption;
    private namesToPartialApps;
    private partialAppsListToAppsNames;
    private partialAppsToMicroservicesNames;
    static ɵfac: i0.ɵɵFactoryDeclaration<DefaultSubscriptionsService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<DefaultSubscriptionsService>;
}

/**
 * The component shows the main view for managing default subscriptions configuration.
 */
declare class DefaultSubscriptionsComponent {
    private fb;
    private defaultSubscriptionsService;
    private alertService;
    /** Default subscriptions inherited from parent tenant. */
    parentDefaultSubscriptions: DefaultSubscriptions;
    /** Default subscriptions defined in the current tenant. */
    currentDefaultSubscriptions: DefaultSubscriptions;
    /** Form object. */
    form: FormGroup;
    /** Whether the configuration is being loaded. */
    loading: boolean;
    /** Hint text for disabled checkboxes. */
    disabledCheckboxHint: "Select \"Override inherited\" to enable.";
    constructor(fb: FormBuilder, defaultSubscriptionsService: DefaultSubscriptionsService, alertService: AlertService);
    /** Initializes the loading of the form and the current settings. */
    ngOnInit(): Promise<void>;
    /** Loads the list of apps, builds the form and hooks value change events for override switches. */
    initForm(): Promise<void>;
    /**
     * Checks if given application row should be displayed.
     * The row is displayed when any of its checkboxes is selected or any of the lists is being overridden.
     */
    shouldShowAppRow(appRowRawValue: any): boolean;
    /** Checks if there are no application rows to be displayed. */
    isEmptyView(): boolean;
    /**
     * Checks if given application is subscribed (present in the given list of applications).
     * @param app Application object to check.
     * @param subscribedApps The list of application objects to check against.
     * @returns True, if the application is present in the list.
     */
    isSubscribed(app: IApplication, subscribedApps: PartialAppsList): boolean;
    /** Saves the current value of form object to backend. */
    save(): Promise<void>;
    private onOverrideOnCreationSubscriptionsChange;
    private enableSubscribeOnCreationCheckboxes;
    private disableSubscribeOnCreationCheckboxes;
    private restoreSubscribeOnCreationFromParent;
    private onOverrideOnUpgradeSubscriptionsChange;
    private enableSubscribeOnUpgradeCheckboxes;
    private disableSubscribeOnUpgradeCheckboxes;
    private restoreSubscribeOnUpgradeFromParent;
    private loadDefaultSubscriptions;
    private getDefaultSubscriptionsForSave;
    static ɵfac: i0.ɵɵFactoryDeclaration<DefaultSubscriptionsComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<DefaultSubscriptionsComponent, "c8y-default-subscriptions", never, {}, {}, never, never, true, never>;
}

declare class DefaultSubscriptionsModule {
    static ɵfac: i0.ɵɵFactoryDeclaration<DefaultSubscriptionsModule, never>;
    static ɵmod: i0.ɵɵNgModuleDeclaration<DefaultSubscriptionsModule, never, [typeof i1.CoreModule, typeof i2.ReactiveFormsModule, typeof DefaultSubscriptionsComponent], [typeof DefaultSubscriptionsComponent]>;
    static ɵinj: i0.ɵɵInjectorDeclaration<DefaultSubscriptionsModule>;
}

export { DefaultSubscriptionsComponent, DefaultSubscriptionsContext, DefaultSubscriptionsModule, DefaultSubscriptionsService };
export type { DefaultSubscriptions, PartialAppsList };
//# sourceMappingURL=index.d.ts.map
