1/*
2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit AbilityKit
19 */
20
21import Want from '../@ohos.app.ability.Want';
22import StartOptions from '../@ohos.app.ability.StartOptions';
23
24/**
25 * Provides the information required for triggering a WantAgent.
26 *
27 * @typedef TriggerInfo
28 * @syscap SystemCapability.Ability.AbilityRuntime.Core
29 * @since 7
30 */
31/**
32 * Provides the information required for triggering a WantAgent.
33 *
34 * @typedef TriggerInfo
35 * @syscap SystemCapability.Ability.AbilityRuntime.Core
36 * @atomicservice
37 * @since 12
38 */
39export interface TriggerInfo {
40  /**
41   * Result code.
42   *
43   * @type { number }
44   * @syscap SystemCapability.Ability.AbilityRuntime.Core
45   * @since 7
46   */
47  /**
48   * Result code.
49   *
50   * @type { number }
51   * @syscap SystemCapability.Ability.AbilityRuntime.Core
52   * @atomicservice
53   * @since 12
54   */
55  code: number;
56
57  /**
58   * Extra Want.
59   * If flags in WantAgentInfo contain CONSTANT_FLAG, this parameter is invalid.
60   * If flags contain REPLACE_ELEMENT, REPLACE_ACTION, REPLACE_URI, REPLACE_ENTITIES, and REPLACE_BUNDLE,
61   * the element, action, uri, entities, and bundleName attributes of the Want specified in this parameter
62   * will be used to replace the corresponding attributes in the original Want, respectively.
63   * If this parameter is null, the original Want remains unchanged.
64   *
65   * @type { ?Want }
66   * @syscap SystemCapability.Ability.AbilityRuntime.Core
67   * @since 7
68   */
69  /**
70   * Extra Want.
71   * If flags in WantAgentInfo contain CONSTANT_FLAG, this parameter is invalid.
72   * If flags contain REPLACE_ELEMENT, REPLACE_ACTION, REPLACE_URI, REPLACE_ENTITIES, and REPLACE_BUNDLE,
73   * the element, action, uri, entities, and bundleName attributes of the Want specified in this parameter
74   * will be used to replace the corresponding attributes in the original Want, respectively.
75   * If this parameter is null, the original Want remains unchanged.
76   *
77   * @type { ?Want }
78   * @syscap SystemCapability.Ability.AbilityRuntime.Core
79   * @atomicservice
80   * @since 12
81   */
82  want?: Want;
83
84  /**
85   * Permission required for a WantAgent recipient.
86   * This parameter is valid only when the WantAgent is triggered to send common events.
87   * If permission is null, no permission is required on the recipient.
88   *
89   * @type { ?string }
90   * @syscap SystemCapability.Ability.AbilityRuntime.Core
91   * @since 7
92   */
93  /**
94   * Permission required for a WantAgent recipient.
95   * This parameter is valid only when the WantAgent is triggered to send common events.
96   * If permission is null, no permission is required on the recipient.
97   *
98   * @type { ?string }
99   * @syscap SystemCapability.Ability.AbilityRuntime.Core
100   * @atomicservice
101   * @since 12
102   */
103  permission?: string;
104
105  /**
106   * Custom extra data you want to add for triggering a WantAgent.
107   *
108   * @type { ?object }
109   * @syscap SystemCapability.Ability.AbilityRuntime.Core
110   * @since 7
111   */
112  /**
113   * Custom extra data you want to add for triggering a WantAgent.
114   *
115   * @type { ?object }
116   * @syscap SystemCapability.Ability.AbilityRuntime.Core
117   * @atomicservice
118   * @since 12
119   */
120  extraInfo?: { [key: string]: any };
121
122  /**
123   * Custom extra data you want to add for triggering a WantAgent.
124   * The ability of this property is same as extraInfo. If both are set, this property will be used.
125   *
126   * @type { ?Record<string, Object> }
127   * @syscap SystemCapability.Ability.AbilityRuntime.Core
128   * @since 11
129   */
130  /**
131   * Custom extra data you want to add for triggering a WantAgent.
132   * The ability of this property is same as extraInfo. If both are set, this property will be used.
133   *
134   * @type { ?Record<string, Object> }
135   * @syscap SystemCapability.Ability.AbilityRuntime.Core
136   * @atomicservice
137   * @since 12
138   */
139  extraInfos?: Record<string, Object>;
140
141  /**
142   * Specific options for triggering a wantagent which is used for starting an ability.
143   *
144   * @type { ?StartOptions }
145   * @syscap SystemCapability.Ability.AbilityRuntime.Core
146   * @systemapi
147   * @stagemodelonly
148   * @since 12
149   */
150   startOptions?: StartOptions;
151}
152