import * as Core from 'cloudflare/core';
import { APIResource } from 'cloudflare/resource';
import * as SettingsAPI from 'cloudflare/resources/pagerules/settings';
export declare class Pagerules extends APIResource {
    settings: SettingsAPI.Settings;
    /**
     * Creates a new Page Rule.
     */
    create(params: PageruleCreateParams, options?: Core.RequestOptions): Core.APIPromise<PageruleCreateResponse>;
    /**
     * Replaces the configuration of an existing Page Rule. The configuration of the
     * updated Page Rule will exactly match the data passed in the API request.
     */
    update(pageruleId: string, params: PageruleUpdateParams, options?: Core.RequestOptions): Core.APIPromise<PageruleUpdateResponse>;
    /**
     * Fetches Page Rules in a zone.
     */
    list(params: PageruleListParams, options?: Core.RequestOptions): Core.APIPromise<PageruleListResponse>;
    /**
     * Deletes an existing Page Rule.
     */
    delete(pageruleId: string, params: PageruleDeleteParams, options?: Core.RequestOptions): Core.APIPromise<PageruleDeleteResponse | null>;
    /**
     * Updates one or more fields of an existing Page Rule.
     */
    edit(pageruleId: string, params: PageruleEditParams, options?: Core.RequestOptions): Core.APIPromise<PageruleEditResponse>;
    /**
     * Fetches the details of a Page Rule.
     */
    get(pageruleId: string, params: PageruleGetParams, options?: Core.RequestOptions): Core.APIPromise<PageruleGetResponse>;
}
export interface PageRule {
    /**
     * Identifier
     */
    id: string;
    /**
     * The set of actions to perform if the targets of this rule match the request.
     * Actions can redirect to another URL or override settings, but not both.
     */
    actions: Array<Route>;
    /**
     * The timestamp of when the Page Rule was created.
     */
    created_on: string;
    /**
     * The timestamp of when the Page Rule was last modified.
     */
    modified_on: string;
    /**
     * The priority of the rule, used to define which Page Rule is processed over
     * another. A higher number indicates a higher priority. For example, if you have a
     * catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to
     * take precedence (rule B: `/images/special/*`), specify a higher priority for
     * rule B so it overrides rule A.
     */
    priority: number;
    /**
     * The status of the Page Rule.
     */
    status: 'active' | 'disabled';
    /**
     * The rule targets to evaluate on each request.
     */
    targets: Array<Target>;
}
export interface Route {
    /**
     * The timestamp of when the override was last modified.
     */
    modified_on?: string;
    /**
     * The type of route.
     */
    name?: 'forward_url';
    value?: Route.Value;
}
export declare namespace Route {
    interface Value {
        /**
         * The response type for the URL redirect.
         */
        type?: 'temporary' | 'permanent';
        /**
         * The URL to redirect the request to. Notes: ${num} refers to the position of '\*'
         * in the constraint value.
         */
        url?: string;
    }
}
/**
 * A request condition target.
 */
export interface Target {
    /**
     * String constraint.
     */
    constraint: Target.Constraint;
    /**
     * A target based on the URL of the request.
     */
    target: 'url';
}
export declare namespace Target {
    /**
     * String constraint.
     */
    interface Constraint {
        /**
         * The matches operator can use asterisks and pipes as wildcard and 'or' operators.
         */
        operator: 'matches' | 'contains' | 'equals' | 'not_equal' | 'not_contain';
        /**
         * The URL pattern to match against the current request. The pattern may contain up
         * to four asterisks ('\*') as placeholders.
         */
        value: string;
    }
}
/**
 * URL target.
 */
export interface URLTarget {
    /**
     * String constraint.
     */
    constraint?: URLTarget.Constraint;
    /**
     * A target based on the URL of the request.
     */
    target?: 'url';
}
export declare namespace URLTarget {
    /**
     * String constraint.
     */
    interface Constraint {
        /**
         * The matches operator can use asterisks and pipes as wildcard and 'or' operators.
         */
        operator: 'matches' | 'contains' | 'equals' | 'not_equal' | 'not_contain';
        /**
         * The URL pattern to match against the current request. The pattern may contain up
         * to four asterisks ('\*') as placeholders.
         */
        value: string;
    }
}
export type PageruleCreateResponse = unknown | string | null;
export type PageruleUpdateResponse = unknown | string | null;
export type PageruleListResponse = Array<PageRule>;
export interface PageruleDeleteResponse {
    /**
     * Identifier
     */
    id: string;
}
export type PageruleEditResponse = unknown | string | null;
export type PageruleGetResponse = unknown | string | null;
export interface PageruleCreateParams {
    /**
     * Path param: Identifier
     */
    zone_id: string;
    /**
     * Body param: The set of actions to perform if the targets of this rule match the
     * request. Actions can redirect to another URL or override settings, but not both.
     */
    actions: Array<Route>;
    /**
     * Body param: The rule targets to evaluate on each request.
     */
    targets: Array<Target>;
    /**
     * Body param: The priority of the rule, used to define which Page Rule is
     * processed over another. A higher number indicates a higher priority. For
     * example, if you have a catch-all Page Rule (rule A: `/images/*`) but want a more
     * specific Page Rule to take precedence (rule B: `/images/special/*`), specify a
     * higher priority for rule B so it overrides rule A.
     */
    priority?: number;
    /**
     * Body param: The status of the Page Rule.
     */
    status?: 'active' | 'disabled';
}
export interface PageruleUpdateParams {
    /**
     * Path param: Identifier
     */
    zone_id: string;
    /**
     * Body param: The set of actions to perform if the targets of this rule match the
     * request. Actions can redirect to another URL or override settings, but not both.
     */
    actions: Array<Route>;
    /**
     * Body param: The rule targets to evaluate on each request.
     */
    targets: Array<Target>;
    /**
     * Body param: The priority of the rule, used to define which Page Rule is
     * processed over another. A higher number indicates a higher priority. For
     * example, if you have a catch-all Page Rule (rule A: `/images/*`) but want a more
     * specific Page Rule to take precedence (rule B: `/images/special/*`), specify a
     * higher priority for rule B so it overrides rule A.
     */
    priority?: number;
    /**
     * Body param: The status of the Page Rule.
     */
    status?: 'active' | 'disabled';
}
export interface PageruleListParams {
    /**
     * Path param: Identifier
     */
    zone_id: string;
    /**
     * Query param: The direction used to sort returned Page Rules.
     */
    direction?: 'asc' | 'desc';
    /**
     * Query param: When set to `all`, all the search requirements must match. When set
     * to `any`, only one of the search requirements has to match.
     */
    match?: 'any' | 'all';
    /**
     * Query param: The field used to sort returned Page Rules.
     */
    order?: 'status' | 'priority';
    /**
     * Query param: The status of the Page Rule.
     */
    status?: 'active' | 'disabled';
}
export interface PageruleDeleteParams {
    /**
     * Path param: Identifier
     */
    zone_id: string;
    /**
     * Body param:
     */
    body: unknown;
}
export interface PageruleEditParams {
    /**
     * Path param: Identifier
     */
    zone_id: string;
    /**
     * Body param: The set of actions to perform if the targets of this rule match the
     * request. Actions can redirect to another URL or override settings, but not both.
     */
    actions?: Array<Route>;
    /**
     * Body param: The priority of the rule, used to define which Page Rule is
     * processed over another. A higher number indicates a higher priority. For
     * example, if you have a catch-all Page Rule (rule A: `/images/*`) but want a more
     * specific Page Rule to take precedence (rule B: `/images/special/*`), specify a
     * higher priority for rule B so it overrides rule A.
     */
    priority?: number;
    /**
     * Body param: The status of the Page Rule.
     */
    status?: 'active' | 'disabled';
    /**
     * Body param: The rule targets to evaluate on each request.
     */
    targets?: Array<Target>;
}
export interface PageruleGetParams {
    /**
     * Identifier
     */
    zone_id: string;
}
export declare namespace Pagerules {
    export import Settings = SettingsAPI.Settings;
    export import SettingListResponse = SettingsAPI.SettingListResponse;
    export import SettingListParams = SettingsAPI.SettingListParams;
}
//# sourceMappingURL=pagerules.d.ts.map