/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef APPSPAWN_SANDBOX_PERMISSION_H
#define APPSPAWN_SANDBOX_PERMISSION_H
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

#include "list.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifdef APPSPAWN_SANDBOX_NEW
#define APP_SANDBOX_FILE_NAME "/appdata-sandbox-app.json"
#else
#define APP_SANDBOX_FILE_NAME "/appdata-sandbox.json"
#endif

#define RENDER_SANDBOX_FILE_NAME      "/appdata-sandbox-render.json"
#define GPU_SANDBOX_FILE_NAME         "/appdata-sandbox-gpu.json"
#define ISOLATED_SANDBOX_FILE_NAME    "/appdata-sandbox-isolated-new.json"
#define DEBUG_SANDBOX_FILE_NAME       "/appdata-sandbox-debug.json"

typedef struct TagSandboxQueue SandboxQueue;
typedef struct TagPermissionNode SandboxPermissionNode;

int32_t AddSandboxPermissionNode(const char *name, SandboxQueue *queue);
int32_t DeleteSandboxPermissions(SandboxQueue *queue);
int32_t GetPermissionIndexInQueue(const SandboxQueue *queue, const char *permission);
const SandboxPermissionNode *GetPermissionNodeInQueue(const SandboxQueue *queue, const char *permission);
const SandboxPermissionNode *GetPermissionNodeInQueueByIndex(const SandboxQueue *queue, int32_t index);
int32_t PermissionRenumber(SandboxQueue *queue);

#ifdef __cplusplus
}
#endif
#endif  // APPSPAWN_SANDBOX_PERMISSION_H