1/*
2 * Copyright (C) 2024 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#ifndef OHOS_RENDER_3D_NAMED_IMPL_H
17#define OHOS_RENDER_3D_NAMED_IMPL_H
18#include <napi_api.h>
19class SceneResourceImpl {
20public:
21    static constexpr uint32_t ID = 1;
22    enum SceneResourceType {
23        /**
24         * The resource is an Unknow.
25         */
26        UNKNOWN = 0,
27        /**
28         * The resource is an Node.
29         */
30        NODE = 1,
31        /**
32         * The resource is an Environment.
33         */
34        ENVIRONMENT = 2,
35        /**
36         * The resource is a Material.
37         */
38        MATERIAL = 3,
39        /**
40         * The resource is a Mesh.
41         */
42        MESH = 4,
43        /**
44         * The resource is an Animation.
45         */
46        ANIMATION = 5,
47        /**
48         * The resource is a Shader.
49         */
50        SHADER = 6,
51
52        /**
53         * The resource is a Image.
54         */
55        IMAGE = 7,
56    };
57    SceneResourceImpl(SceneResourceType type);
58    virtual ~SceneResourceImpl();
59    static void RegisterEnums(NapiApi::Object exports);
60
61    void* GetInstanceImpl(uint32_t id);
62
63protected:
64    static void GetPropertyDescs(BASE_NS::vector<napi_property_descriptor>& props);
65
66    void SetUri(const NapiApi::StrongRef& uri);
67    napi_value GetObjectType(NapiApi::FunctionContext<>& ctx);
68    napi_value GetName(NapiApi::FunctionContext<>& ctx);
69    void SetName(NapiApi::FunctionContext<BASE_NS::string>& ctx);
70    napi_value GetUri(NapiApi::FunctionContext<>& ctx);
71    napi_value Dispose(NapiApi::FunctionContext<>& ctx);
72
73    NapiApi::StrongRef scene_;
74private:
75    SceneResourceType type_;
76    NapiApi::StrongRef uri_;
77};
78#endif // OHOS_RENDER_3D_NAMED_IMPL_H