1/*
2 * Copyright (c) 2022 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
21/**
22 * The bundle pack info class.
23 *
24 * @typedef BundlePackInfo
25 * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
26 * @systemapi
27 * @since 9
28 */
29export interface BundlePackInfo {
30  /**
31   * This contains package information in pack.info
32   *
33   * @type { Array<PackageConfig> }
34   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
35   * @systemapi
36   * @since 9
37   */
38  readonly packages: Array<PackageConfig>;
39
40  /**
41   * This contains bundle summary information in pack.info
42   *
43   * @type { PackageSummary }
44   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
45   * @systemapi
46   * @since 9
47   */
48  readonly summary: PackageSummary;
49}
50
51/**
52 * PackageConfig: the package info class.
53 *
54 * @typedef PackageConfig
55 * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
56 * @systemapi
57 * @since 9
58 */
59export interface PackageConfig {
60  /**
61   * Indicates the device types of this package
62   *
63   * @type { Array<string> }
64   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
65   * @systemapi
66   * @since 9
67   */
68  readonly deviceTypes: Array<string>;
69
70  /**
71   * Indicates the name of this package
72   *
73   * @type { string }
74   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
75   * @systemapi
76   * @since 9
77   */
78  readonly name: string;
79
80  /**
81   * Indicates the module type of this package
82   *
83   * @type { string }
84   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
85   * @systemapi
86   * @since 9
87   */
88  readonly moduleType: string;
89
90  /**
91   * Indicates whether this package is delivery and install
92   *
93   * @type { boolean }
94   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
95   * @systemapi
96   * @since 9
97   */
98  readonly deliveryWithInstall: boolean;
99}
100
101/**
102 * PackageSummary: the package summary class.
103 *
104 * @typedef PackageSummary
105 * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
106 * @systemapi
107 * @since 9
108 */
109export interface PackageSummary {
110  /**
111   * Indicates the bundle config info of this package
112   *
113   * @type { BundleConfigInfo }
114   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
115   * @systemapi
116   * @since 9
117   */
118  readonly app: BundleConfigInfo;
119
120  /**
121   * Indicates the modules config info of this package
122   *
123   * @type { Array<ModuleConfigInfo> }
124   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
125   * @systemapi
126   * @since 9
127   */
128  readonly modules: Array<ModuleConfigInfo>;
129}
130
131/**
132 * BundleConfigInfo: the bundle summary class.
133 *
134 * @typedef BundleConfigInfo
135 * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
136 * @systemapi
137 * @since 9
138 */
139export interface BundleConfigInfo {
140  /**
141   * Indicates the name of this bundle
142   *
143   * @type { string }
144   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
145   * @systemapi
146   * @since 9
147   */
148  readonly bundleName: string;
149
150  /**
151   * Indicates the bundle version
152   *
153   * @type { Version }
154   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
155   * @systemapi
156   * @since 9
157   */
158  readonly version: Version;
159}
160
161/**
162 * ExtensionAbility: the extension ability forms class.
163 *
164 * @typedef ExtensionAbility
165 * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
166 * @systemapi
167 * @since 9
168 */
169export interface ExtensionAbility {
170  /**
171   * Indicates the name of this extension ability
172   *
173   * @type { string }
174   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
175   * @systemapi
176   * @since 9
177   */
178  readonly name: string;
179
180  /**
181   * Indicates the ability forms info
182   *
183   * @type { Array<AbilityFormInfo> }
184   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
185   * @systemapi
186   * @since 9
187   */
188  readonly forms: Array<AbilityFormInfo>;
189}
190
191/**
192 * ModuleConfigInfo: the module summary of a bundle.
193 *
194 * @typedef ModuleConfigInfo
195 * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
196 * @systemapi
197 * @since 9
198 */
199export interface ModuleConfigInfo {
200  /**
201   * Indicates the name of main ability
202   *
203   * @type { string }
204   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
205   * @systemapi
206   * @since 9
207   */
208  readonly mainAbility: string;
209
210  /**
211   * Indicates the api version
212   *
213   * @type { ApiVersion }
214   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
215   * @systemapi
216   * @since 9
217   */
218  readonly apiVersion: ApiVersion;
219
220  /**
221   * Indicates the devices type
222   *
223   * @type { Array<string> }
224   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
225   * @systemapi
226   * @since 9
227   */
228  readonly deviceTypes: Array<string>;
229
230  /**
231   * Indicates the module distro info
232   *
233   * @type { ModuleDistroInfo }
234   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
235   * @systemapi
236   * @since 9
237   */
238  readonly distro: ModuleDistroInfo;
239
240  /**
241   * Indicates the abilities info of this module
242   *
243   * @type { Array<ModuleAbilityInfo> }
244   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
245   * @systemapi
246   * @since 9
247   */
248  readonly abilities: Array<ModuleAbilityInfo>;
249
250  /**
251   * Indicates extension abilities info of this module
252   *
253   * @type { Array<ExtensionAbility> }
254   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
255   * @systemapi
256   * @since 9
257   */
258  readonly extensionAbilities: Array<ExtensionAbility>;
259}
260
261/**
262 * ModuleDistroInfo: the bundle info summary class.
263 *
264 * @typedef ModuleDistroInfo
265 * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
266 * @systemapi
267 * @since 9
268 */
269export interface ModuleDistroInfo {
270  /**
271   * Indicates whether this package is delivered with install
272   *
273   * @type { boolean }
274   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
275   * @systemapi
276   * @since 9
277   */
278  readonly deliveryWithInstall: boolean;
279
280  /**
281   * Indicates whether this package is free install
282   *
283   * @type { boolean }
284   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
285   * @systemapi
286   * @since 9
287   */
288  readonly installationFree: boolean;
289
290  /**
291   * Indicates the module name
292   *
293   * @type { string }
294   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
295   * @systemapi
296   * @since 9
297   */
298  readonly moduleName: string;
299
300  /**
301   * Indicates the module type
302   *
303   * @type { string }
304   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
305   * @systemapi
306   * @since 9
307   */
308  readonly moduleType: string;
309}
310
311/**
312 * ModuleAbilityInfo: the ability info of a module.
313 *
314 * @typedef ModuleAbilityInfo
315 * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
316 * @systemapi
317 * @since 9
318 */
319export interface ModuleAbilityInfo {
320  /**
321   * Indicates the name of this module ability
322   *
323   * @type { string }
324   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
325   * @systemapi
326   * @since 9
327   */
328  readonly name: string;
329
330  /**
331   * Indicates the label of this module ability
332   *
333   * @type { string }
334   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
335   * @systemapi
336   * @since 9
337   */
338  readonly label: string;
339
340  /**
341   * Indicates whether this ability can be called by other abilities
342   *
343   * @type { boolean }
344   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
345   * @systemapi
346   * @since 9
347   */
348  readonly exported: boolean;
349
350  /**
351   * Indicates the ability forms info
352   *
353   * @type { Array<AbilityFormInfo> }
354   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
355   * @systemapi
356   * @since 9
357   */
358  readonly forms: Array<AbilityFormInfo>;
359}
360
361/**
362 * AbilityFormInfo: the form info of an ability.
363 *
364 * @typedef AbilityFormInfo
365 * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
366 * @systemapi
367 * @since 9
368 */
369export interface AbilityFormInfo {
370  /**
371   * Indicates the name of this ability
372   *
373   * @type { string }
374   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
375   * @systemapi
376   * @since 9
377   */
378  readonly name: string;
379
380  /**
381   * Indicates the type of this ability
382   *
383   * @type { string }
384   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
385   * @systemapi
386   * @since 9
387   */
388  readonly type: string;
389
390  /**
391   * Indicates whether this form is enabled update
392   *
393   * @type { boolean }
394   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
395   * @systemapi
396   * @since 9
397   */
398  readonly updateEnabled: boolean;
399
400  /**
401   * Indicates the scheduled update time
402   *
403   * @type { string }
404   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
405   * @systemapi
406   * @since 9
407   */
408  readonly scheduledUpdateTime: string;
409
410  /**
411   * Indicates the update duration
412   *
413   * @type { number }
414   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
415   * @systemapi
416   * @since 9
417   */
418  readonly updateDuration: number;
419
420  /**
421   * Indicates the ability support dimensions
422   *
423   * @type { Array<string> }
424   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
425   * @systemapi
426   * @since 9
427   */
428  readonly supportDimensions: Array<string>;
429
430  /**
431   * Indicates the ability default dimension
432   *
433   * @type { string }
434   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
435   * @systemapi
436   * @since 9
437   */
438  readonly defaultDimension: string;
439}
440
441/**
442 * Version: the bundle version class.
443 *
444 * @typedef Version
445 * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
446 * @systemapi
447 * @since 9
448 */
449export interface Version {
450  /**
451   * Indicates the min compatible code of this version
452   *
453   * @type { number }
454   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
455   * @systemapi
456   * @since 9
457   */
458  readonly minCompatibleVersionCode: number;
459
460  /**
461   * Indicates the name of this version
462   *
463   * @type { string }
464   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
465   * @systemapi
466   * @since 9
467   */
468  readonly name: string;
469
470  /**
471   * Indicates the code of this version
472   *
473   * @type { number }
474   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
475   * @systemapi
476   * @since 9
477   */
478  readonly code: number;
479}
480
481/**
482 * ApiVersion: the bundle Api version class.
483 *
484 * @typedef ApiVersion
485 * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
486 * @systemapi
487 * @since 9
488 */
489export interface ApiVersion {
490  /**
491   * Indicates the release type of the api
492   *
493   * @type { string }
494   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
495   * @systemapi
496   * @since 9
497   */
498  readonly releaseType: string;
499
500  /**
501   * Indicates the compatible version code of the api
502   *
503   * @type { number }
504   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
505   * @systemapi
506   * @since 9
507   */
508  readonly compatible: number;
509
510  /**
511   * Indicates the target version code of the api
512   *
513   * @type { number }
514   * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall
515   * @systemapi
516   * @since 9
517   */
518  readonly target: number;
519}
520