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#ifndef SUB_PAGE_H
17#define SUB_PAGE_H
18
19#include "base_page.h"
20#include "page.h"
21#include "view_api.h"
22
23namespace Updater {
24class SubPage : public Page {
25    friend class Page;
26public:
27    [[nodiscard]] bool BuildSubPage(UxSubPageInfo &subpageInfo);
28    std::string GetPageId() override;
29    void SetVisible(bool isVisible) override;
30    bool IsVisible() const override;
31    OHOS::UIViewGroup *GetView() const override;
32    bool IsValid() const override;
33    bool IsValidCom(const std::string &id) const override;
34    ViewProxy &operator[](const std::string &id) override;
35    static bool IsPageInfoValid(const UxSubPageInfo &info);
36private:
37    SubPage();
38    SubPage(const std::shared_ptr<Page> &basePage, const std::string &pageId);
39    void Reset();
40    std::shared_ptr<Page> basePage_;
41    std::string pageId_;
42    std::vector<std::string> comsId_;
43    bool isVisible_;
44    OHOS::ColorType color_;
45};
46} // namespace Updater
47#endif
48