| 1 | /************************************************************************************ |
| 2 | * |
| 3 | * D++, A Lightweight C++ library for Discord |
| 4 | * |
| 5 | * SPDX-License-Identifier: Apache-2.0 |
| 6 | * Copyright 2021 Craig Edwards and D++ contributors |
| 7 | * (https://github.com/brainboxdotcc/DPP/graphs/contributors) |
| 8 | * |
| 9 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 | * you may not use this file except in compliance with the License. |
| 11 | * You may obtain a copy of the License at |
| 12 | * |
| 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | * |
| 15 | * Unless required by applicable law or agreed to in writing, software |
| 16 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | * See the License for the specific language governing permissions and |
| 19 | * limitations under the License. |
| 20 | * |
| 21 | ************************************************************************************/ |
| 22 | #pragma once |
| 23 | #include <dpp/export.h> |
| 24 | #include <dpp/snowflake.h> |
| 25 | #include <dpp/managed.h> |
| 26 | #include <dpp/json_fwd.h> |
| 27 | #include <unordered_map> |
| 28 | #include <dpp/json_interface.h> |
| 29 | |
| 30 | namespace dpp { |
| 31 | |
| 32 | /** |
| 33 | * @brief Represents the privacy of a stage instance |
| 34 | */ |
| 35 | enum stage_privacy_level : uint8_t { |
| 36 | /** |
| 37 | * @brief The Stage instance is visible publicly, such as on Stage Discovery. |
| 38 | */ |
| 39 | sp_public = 1, |
| 40 | |
| 41 | /** |
| 42 | * @brief The Stage instance is visible to only guild members. |
| 43 | */ |
| 44 | sp_guild_only = 2 |
| 45 | }; |
| 46 | |
| 47 | /** |
| 48 | * @brief A stage instance. |
| 49 | * Stage instances are like a conference facility, with moderators/speakers and listeners. |
| 50 | */ |
| 51 | struct DPP_EXPORT stage_instance : public managed, public json_interface<stage_instance> { |
| 52 | protected: |
| 53 | friend struct json_interface<stage_instance>; |
| 54 | |
| 55 | /** |
| 56 | * @brief Serialise a stage_instance object rom json |
| 57 | * |
| 58 | * @return stage_instance& a reference to self |
| 59 | */ |
| 60 | stage_instance& fill_from_json_impl(const nlohmann::json* j); |
| 61 | |
| 62 | /** |
| 63 | * @brief Build json for this object |
| 64 | * |
| 65 | * @param with_id include ID |
| 66 | * @return json Json of this object |
| 67 | */ |
| 68 | virtual json to_json_impl(bool with_id = false) const; |
| 69 | |
| 70 | public: |
| 71 | /** |
| 72 | * @brief The guild ID of the associated Stage channel. |
| 73 | */ |
| 74 | snowflake guild_id; |
| 75 | |
| 76 | /** |
| 77 | * @brief The ID of the associated Stage channel. |
| 78 | */ |
| 79 | snowflake channel_id; |
| 80 | |
| 81 | /** |
| 82 | * @brief The topic of the Stage instance (1-120 characters). |
| 83 | */ |
| 84 | std::string topic; |
| 85 | |
| 86 | /** |
| 87 | * @brief The privacy level of the Stage instance. |
| 88 | */ |
| 89 | stage_privacy_level privacy_level; |
| 90 | |
| 91 | /** |
| 92 | * @brief Whether or not Stage Discovery is disabled. |
| 93 | */ |
| 94 | bool discoverable_disabled; |
| 95 | |
| 96 | /** |
| 97 | * @brief Create a stage_instance object |
| 98 | */ |
| 99 | stage_instance(); |
| 100 | |
| 101 | /** |
| 102 | * @brief Destroy the stage_instance object |
| 103 | */ |
| 104 | ~stage_instance() = default; |
| 105 | }; |
| 106 | |
| 107 | /** |
| 108 | * @brief A group of stage instances |
| 109 | */ |
| 110 | typedef std::unordered_map<snowflake, stage_instance> stage_instance_map; |
| 111 | |
| 112 | } |