import type { Record, TableName } from '@servicenow/sdk-core/db';
import type { BusinessRule, Role } from '@servicenow/sdk-core/app';
import type { ClientScript } from '@servicenow/sdk-core/clientscript';
import type { SecurityAclUserAccessConfig } from './security-acl-config';
type State = 'published' | 'draft' | 'committed' | 'withdrawn';
type ExecutionMode = 'copilot' | 'autopilot';
type RecordType = 'custom' | 'template' | 'aia_internal';
type TriggerFlowDefinition = 'record_create' | 'record_create_or_update' | 'record_update' | 'email' | 'scheduled' | 'daily' | 'weekly' | 'monthly' | 'ui_action';
type TriggerStrategy = 'every' | 'immediate' | 'manual' | 'once' | 'repeat_every' | 'unique_changes' | '';
export type TeamType = Now.Internal.WithID<{
    name?: string;
    description?: string;
    /** Domain ID */
    sysDomain?: string;
    /** Team members array (agent sys_ids or names) */
    members?: (string | Record<'sn_aia_agent'>)[];
}>;
export type AIAVersion = {
    /** Version name (Translated Text) */
    name: string;
    /** Version number (Integer) */
    number?: number;
    /** Instructions (Translated Text) */
    instructions?: string;
    /** @default "draft" */
    state?: State;
    /** Condition (Condition String) */
    condition?: string;
};
type AiAgenticWorkflowType = Now.Internal.WithID<{
    /** The display name of the AI Agentic Workflow */
    name: string;
    /** Description of the AI Agentic Workflow */
    description: string;
    /** Context processing script for the workflow - supports inline scripts or Now.include() for external files */
    contextProcessingScript?: ((task: any, user_utterance: any, workflow_id: any, context: any, ...dependencies: any[]) => any) | string;
    /** Domain ID */
    sysDomain?: string;
    /** Execution mode (tools override) - choices: copilot or autopilot */
    executionMode?: ExecutionMode;
    /** Record type for the workflow */
    recordType?: RecordType;
    /** Memory scope for team members */
    memoryScope?: string;
    /** Team configuration */
    team?: TeamType;
    /** Whether the workflow is active */
    active?: boolean;
    /** Automatically generates sys_security_acl and sys_security_acl_role records for this workflow */
    securityAcl: SecurityAclUserAccessConfig;
    /** Data access controls (Dynamic User identity type). Can be empty/omitted when runAsUser is set. */
    runAs?: string;
    dataAccess?: DataAccessConfigWorkflowType;
    versions?: AIAVersion[];
    triggerConfig?: TriggerConfigType[];
}>;
/**
 * Type representing schedule configuration for scheduled triggers.
 * Used when triggerFlowDefinitionType is 'scheduled', 'daily', 'weekly', or 'monthly'
 */
export type ScheduleConfigWorkflowType = {
    /** Day of Month (1-31) - used for monthly schedules */
    runDayOfMonth?: number;
    /** Day of Week (1-7, where 1=Sunday, 7=Saturday) - used for weekly/daily schedules */
    runDayOfWeek?: number;
    /** Repeat Interval (Duration) - format: YYYY-MM-DD HH:MM:SS (e.g., '1970-01-05 12:00:00' for repeat every 5 days) */
    repeatInterval?: string;
    /** Starting date/time - format: YYYY-MM-DD HH:MM:SS (e.g., '2026-01-26 10:00:00') */
    starting?: string;
    /** Time of day - format: YYYY-MM-DD HH:MM:SS (e.g., '1970-01-01 12:00:00' for 12:00 PM) */
    time?: string;
    /** Trigger strategy - valid values: 'every', 'immediate', 'manual', 'once', 'repeat_every', or empty string */
    triggerStrategy?: TriggerStrategy;
};
/**
 * Type representing the properties of a Trigger Configuration.
 */
export type TriggerConfigType = {
    /** Name of the trigger */
    name: string;
    /** Description of the trigger */
    description?: string;
    /** Active status - defaults to false */
    active?: boolean;
    /** Reference to Messaging Channel - defaults to Now Assist Panel. Use string value: "Now Assist Panel" */
    channel: string;
    /** Conditions for the trigger (encoded query) */
    triggerCondition: string;
    /** Enable discovery flag - defaults to FALSE */
    enableDiscovery?: boolean;
    /** Reference to Client Script for notifications */
    notificationScript?: string | Record<'sys_script_client'> | ReturnType<typeof ClientScript>;
    /** Objective template */
    objectiveTemplate: string;
    /** @default "Help me resolve ${number}" */
    /** Reference to Now Assist Deployment Channel (sys_id or Record<'now_assist_deployment_channel'>) */
    portal?: string | Record<'now_assist_deployment_channel'>;
    /** Reference to Now Assist Deployment (sys_id or Record<'now_assist_deployment'>) */
    profile?: string | Record<'now_assist_deployment'>;
    /** Run as field name */
    runAs?: string;
    /** Run as script - supports inline scripts or Now.include() for external files */
    runAsScript?: ((current: any, ...dependencies: any[]) => string) | string;
    /** Reference to User who runs the trigger (user sys_id or Record<'sys_user'>) */
    runAsUser?: string | Record<'sys_user'>;
    /** Reference to Business Rule (sys_id, Record<'sys_script'>, or BusinessRule) */
    businessRule?: string | Record<'sys_script'> | ReturnType<typeof BusinessRule>;
    /** Show notifications flag */
    showNotifications?: boolean;
    /** Domain ID */
    domain?: string;
    /** Target table name (Table Name) */
    targetTable: TableName;
    /** Trigger flow definition type - choices: record_create, record_create_or_update, record_update, email, scheduled, daily, weekly, monthly */
    triggerFlowDefinitionType: TriggerFlowDefinition;
    /** Schedule configuration - used for scheduled triggers (scheduled, daily, weekly, monthly) */
    schedule?: ScheduleConfigWorkflowType;
    /** Reference to override the trigger-agent-usecase mapping (sn_aia_trigger_agent_usecase_m2m) */
    sysOverrides?: string | Record<'sn_aia_trigger_agent_usecase_m2m'>;
};
export type DataAccessConfigWorkflowType = {
    /** Description of the role configuration */
    description?: string;
    /** Role list (array of role sys_ids, Role objects, or Record<'sys_user_role'>) */
    roleList: (string | Role | Record<'sys_user_role'>)[];
};
/**
 * Creates an AI Agentic Workflow that defines dynamic behavior for agentic workflows
 *
 * @param config - an object containing the following properties:
 *   * **name** - The display name of the AI Agentic Workflow
 *   * **description** - A brief description of what the AI Agentic Workflow does
 *   * **securityAcl** - Automatically generates sys_security_acl and sys_security_acl_role records for this workflow
 *   * **contextProcessingScript**? - Script that processes context for the workflow
 *   * **sysDomain**? - Domain ID
 *   * **executionMode**? - Execution mode (default: "copilot")
 *   * **recordType**? - Record type for the workflow (default: "template")
 *   * **team**? - Team configuration with nested members array
 *   * **active**? - Whether the workflow is active (default: true)
 *   * **runAs**? - User to run workflow as (sys_id or Record reference)
 *   * **dataAccess**? - Data access controls (required when runAs is empty)
 *   * **versions**? - Array of version configurations
 *   * **triggerConfig**? - Array of trigger configurations for automatic invocation
 */
export declare function AiAgenticWorkflow(config: AiAgenticWorkflowType): AiAgenticWorkflowType;
export {};
