161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit ArkData
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport collections from '../arkts/@arkts.collections';
2261847f8eSopenharmony_ciimport lang from '../arkts/@arkts.lang';
2361847f8eSopenharmony_ciimport relationalStore from './@ohos.data.relationalStore';
2461847f8eSopenharmony_ci
2561847f8eSopenharmony_ci/**
2661847f8eSopenharmony_ci * Provides methods for creating and deleting an RDB store.
2761847f8eSopenharmony_ci *
2861847f8eSopenharmony_ci * @namespace sendableRelationalStore
2961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
3061847f8eSopenharmony_ci * @since 12
3161847f8eSopenharmony_ci */
3261847f8eSopenharmony_cideclare namespace sendableRelationalStore {
3361847f8eSopenharmony_ci  /**
3461847f8eSopenharmony_ci   * Defines information of an asset.
3561847f8eSopenharmony_ci   *
3661847f8eSopenharmony_ci   * @interface Asset
3761847f8eSopenharmony_ci   * @extends lang.ISendable
3861847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
3961847f8eSopenharmony_ci   * @since 12
4061847f8eSopenharmony_ci   */
4161847f8eSopenharmony_ci  interface Asset extends lang.ISendable {
4261847f8eSopenharmony_ci    /**
4361847f8eSopenharmony_ci     * Name of the asset.
4461847f8eSopenharmony_ci     *
4561847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
4661847f8eSopenharmony_ci     * @since 12
4761847f8eSopenharmony_ci     */
4861847f8eSopenharmony_ci    name: string;
4961847f8eSopenharmony_ci
5061847f8eSopenharmony_ci    /**
5161847f8eSopenharmony_ci     * URI of the asset.
5261847f8eSopenharmony_ci     *
5361847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
5461847f8eSopenharmony_ci     * @since 12
5561847f8eSopenharmony_ci     */
5661847f8eSopenharmony_ci    uri: string;
5761847f8eSopenharmony_ci
5861847f8eSopenharmony_ci    /**
5961847f8eSopenharmony_ci     * Path of the asset.
6061847f8eSopenharmony_ci     *
6161847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
6261847f8eSopenharmony_ci     * @since 12
6361847f8eSopenharmony_ci     */
6461847f8eSopenharmony_ci    path: string;
6561847f8eSopenharmony_ci
6661847f8eSopenharmony_ci    /**
6761847f8eSopenharmony_ci     * Time when the asset was created.
6861847f8eSopenharmony_ci     *
6961847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
7061847f8eSopenharmony_ci     * @since 12
7161847f8eSopenharmony_ci     */
7261847f8eSopenharmony_ci    createTime: string;
7361847f8eSopenharmony_ci
7461847f8eSopenharmony_ci    /**
7561847f8eSopenharmony_ci     * Time when the asset was last modified.
7661847f8eSopenharmony_ci     *
7761847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
7861847f8eSopenharmony_ci     * @since 12
7961847f8eSopenharmony_ci     */
8061847f8eSopenharmony_ci    modifyTime: string;
8161847f8eSopenharmony_ci
8261847f8eSopenharmony_ci    /**
8361847f8eSopenharmony_ci     * Size of the asset.
8461847f8eSopenharmony_ci     *
8561847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
8661847f8eSopenharmony_ci     * @since 12
8761847f8eSopenharmony_ci     */
8861847f8eSopenharmony_ci    size: string;
8961847f8eSopenharmony_ci
9061847f8eSopenharmony_ci    /**
9161847f8eSopenharmony_ci     * Status of the asset.
9261847f8eSopenharmony_ci     *
9361847f8eSopenharmony_ci     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
9461847f8eSopenharmony_ci     * @since 12
9561847f8eSopenharmony_ci     */
9661847f8eSopenharmony_ci    status?: number;
9761847f8eSopenharmony_ci  }
9861847f8eSopenharmony_ci
9961847f8eSopenharmony_ci  /**
10061847f8eSopenharmony_ci   * Defines multiple assets in a column.
10161847f8eSopenharmony_ci   *
10261847f8eSopenharmony_ci   * @typedef { collections.Array<Asset> } Assets
10361847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
10461847f8eSopenharmony_ci   * @since 12
10561847f8eSopenharmony_ci   */
10661847f8eSopenharmony_ci  type Assets = collections.Array<Asset>;
10761847f8eSopenharmony_ci
10861847f8eSopenharmony_ci  /**
10961847f8eSopenharmony_ci   * Defines the types of the value in a KV pair.
11061847f8eSopenharmony_ci   *
11161847f8eSopenharmony_ci   * @typedef { null | number | string | boolean | collections.Uint8Array | Asset | Assets |
11261847f8eSopenharmony_ci   * collections.Float32Array | bigint } ValueType
11361847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
11461847f8eSopenharmony_ci   * @since 12
11561847f8eSopenharmony_ci   */
11661847f8eSopenharmony_ci  type ValueType = null | number | string | boolean | collections.Uint8Array | Asset | Assets |
11761847f8eSopenharmony_ci    collections.Float32Array | bigint;
11861847f8eSopenharmony_ci
11961847f8eSopenharmony_ci  /**
12061847f8eSopenharmony_ci   * Defines the data stored in KV pairs in a ValuesBucket object.
12161847f8eSopenharmony_ci   *
12261847f8eSopenharmony_ci   * @typedef { collections.Map<string, ValueType> } ValuesBucket
12361847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
12461847f8eSopenharmony_ci   * @since 12
12561847f8eSopenharmony_ci   */
12661847f8eSopenharmony_ci  type ValuesBucket = collections.Map<string, ValueType>;
12761847f8eSopenharmony_ci
12861847f8eSopenharmony_ci  /**
12961847f8eSopenharmony_ci   * Defines NonSendableBucket for convenience.
13061847f8eSopenharmony_ci   *
13161847f8eSopenharmony_ci   * @typedef { relationalStore.ValuesBucket } NonSendableBucket
13261847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
13361847f8eSopenharmony_ci   * @since 12
13461847f8eSopenharmony_ci   */
13561847f8eSopenharmony_ci  type NonSendableBucket = relationalStore.ValuesBucket;
13661847f8eSopenharmony_ci
13761847f8eSopenharmony_ci  /**
13861847f8eSopenharmony_ci   * Defines NonSendableAsset for convenience.
13961847f8eSopenharmony_ci   *
14061847f8eSopenharmony_ci   * @typedef { relationalStore.Asset } NonSendableAsset
14161847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
14261847f8eSopenharmony_ci   * @since 12
14361847f8eSopenharmony_ci   */
14461847f8eSopenharmony_ci  type NonSendableAsset = relationalStore.Asset;
14561847f8eSopenharmony_ci
14661847f8eSopenharmony_ci  /**
14761847f8eSopenharmony_ci   * Converts a sendable <b>valuesBucket</b> object to a non-sendable <b>valuesBucket</b> object.
14861847f8eSopenharmony_ci   *
14961847f8eSopenharmony_ci   * @param { ValuesBucket } valuesBucket - Indicates the sendable <b>valuesBucket</b> object to convert.
15061847f8eSopenharmony_ci   * @returns { NonSendableBucket } a non-sendable <b>valuesBucket</b> object. For details,
15161847f8eSopenharmony_ci   *   see {@link NonSendableBucket}.
15261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
15361847f8eSopenharmony_ci   * <br>2. Incorrect parameter types;3. Parameter verification failed.
15461847f8eSopenharmony_ci   * @throws { BusinessError } 14800000 - Inner error.
15561847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
15661847f8eSopenharmony_ci   * @since 12
15761847f8eSopenharmony_ci   */
15861847f8eSopenharmony_ci  function fromSendableValuesBucket(valuesBucket: ValuesBucket): NonSendableBucket;
15961847f8eSopenharmony_ci
16061847f8eSopenharmony_ci  /**
16161847f8eSopenharmony_ci   * Converts a non-sendable <b>valuesBucket</b> object to a sendable <b>valuesBucket</b> object.
16261847f8eSopenharmony_ci   *
16361847f8eSopenharmony_ci   * @param { NonSendableBucket } valuesBucket - Indicates the non-sendable <b>valuesBucket</b> object to convert.
16461847f8eSopenharmony_ci   * @returns { ValuesBucket } a sendable <b>valuesBucket</b> object. For details, see {@link ValuesBucket}.
16561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
16661847f8eSopenharmony_ci   * <br>2. Incorrect parameter types;3. Parameter verification failed.
16761847f8eSopenharmony_ci   * @throws { BusinessError } 14800000 - Inner error.
16861847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
16961847f8eSopenharmony_ci   * @since 12
17061847f8eSopenharmony_ci   */
17161847f8eSopenharmony_ci  function toSendableValuesBucket(valuesBucket: NonSendableBucket): ValuesBucket;
17261847f8eSopenharmony_ci
17361847f8eSopenharmony_ci    /**
17461847f8eSopenharmony_ci   * Converts a sendable <b>asset</b> object to a non-sendable <b>asset</b> object.
17561847f8eSopenharmony_ci   *
17661847f8eSopenharmony_ci   * @param { Asset } asset - Indicates the sendable <b>asset</b> object to convert.
17761847f8eSopenharmony_ci   * @returns { NonSendableAsset } a non-sendable <b>asset</b> object. For details, see {@link NonSendableAsset}.
17861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
17961847f8eSopenharmony_ci   * <br>2. Incorrect parameter types;3. Parameter verification failed.
18061847f8eSopenharmony_ci   * @throws { BusinessError } 14800000 - Inner error.
18161847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
18261847f8eSopenharmony_ci   * @since 12
18361847f8eSopenharmony_ci   */
18461847f8eSopenharmony_ci  function fromSendableAsset(asset: Asset): NonSendableAsset;
18561847f8eSopenharmony_ci
18661847f8eSopenharmony_ci  /**
18761847f8eSopenharmony_ci   * Converts a non-sendable <b>asset</b> object to a sendable <b>asset</b> object.
18861847f8eSopenharmony_ci   *
18961847f8eSopenharmony_ci   * @param { NonSendableAsset } asset - Indicates the non-sendable <b>asset</b> object to convert.
19061847f8eSopenharmony_ci   * @returns { Asset } a sendable <b>asset</b> object. For details, see {@link Asset}.
19161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
19261847f8eSopenharmony_ci   * <br>2. Incorrect parameter types;3. Parameter verification failed.
19361847f8eSopenharmony_ci   * @throws { BusinessError } 14800000 - Inner error.
19461847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
19561847f8eSopenharmony_ci   * @since 12
19661847f8eSopenharmony_ci   */
19761847f8eSopenharmony_ci  function toSendableAsset(asset: NonSendableAsset): Asset;
19861847f8eSopenharmony_ci}
19961847f8eSopenharmony_ci
20061847f8eSopenharmony_ciexport default sendableRelationalStore;