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 BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_DO_NOT_DISTURB_PROFILE_H 17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_DO_NOT_DISTURB_PROFILE_H 18 19 #include "notification_bundle_option.h" 20 #include "parcel.h" 21 22 namespace OHOS { 23 namespace Notification { 24 class NotificationDoNotDisturbProfile : public Parcelable { 25 public: 26 /** 27 * Default constructor used to create a NotificationDoNotDisturbProfile instance. 28 */ 29 NotificationDoNotDisturbProfile() = default; 30 31 /** 32 * A constructor used to create a NotificationDoNotDisturbProfile instance with the input parameters passed. 33 * 34 * @param id Indicates the profile id to add. 35 * @param name Indicates the profile name to add. 36 * @param trustlist Indicates the profile trustlist to add. 37 */ 38 NotificationDoNotDisturbProfile( 39 int32_t id, const std::string &name, const std::vector<NotificationBundleOption> &trustList); 40 41 /** 42 * Default deconstructor used to deconstruct. 43 */ 44 ~NotificationDoNotDisturbProfile() = default; 45 46 /** 47 * Sets profile id for this NotificationDoNotDisturbProfile. 48 * 49 * @param profileId Indicates the profile id to add. 50 */ 51 void SetProfileId(int32_t id); 52 53 /** 54 * Sets profile name for this NotificationDoNotDisturbProfile. 55 * 56 * @param profileName Indicates the profile name to add. 57 */ 58 void SetProfileName(const std::string &name); 59 60 /** 61 * Sets profile trustlist for this NotificationDoNotDisturbProfile. 62 * 63 * @param profileTrustlist Indicates the profile trustlist to add. 64 * For available values, see NotificationBundleOption. 65 */ 66 void SetProfileTrustList(const std::vector<NotificationBundleOption> &trustList); 67 68 /** 69 * Obtains the profile id of this NotificationDoNotDisturbProfile. 70 * 71 * @return the profile id of this NotificationDoNotDisturbProfile. 72 */ 73 int32_t GetProfileId() const; 74 75 /** 76 * Obtains the profile name of this NotificationDoNotDisturbProfile. 77 * 78 * @return the profile name of this NotificationDoNotDisturbProfile. 79 */ 80 std::string GetProfileName() const; 81 82 /** 83 * Obtains the profile trustlist of this NotificationDoNotDisturbProfile. 84 * 85 * @return the profile trustlist of this NotificationDoNotDisturbProfile, 86 * For available values, see NotificationBundleOption. 87 */ 88 std::vector<NotificationBundleOption> GetProfileTrustList() const; 89 90 /** 91 * Marshal a object into a Parcel. 92 * 93 * @param parcel the object into the parcel 94 */ 95 bool Marshalling(Parcel &parcel) const override; 96 97 /** 98 * Read a NotificationDoNotDisturbProfile object from a Parcel. 99 * 100 * @param parcel the parcel 101 */ 102 bool ReadFromParcel(Parcel &parcel); 103 104 static NotificationDoNotDisturbProfile *Unmarshalling(Parcel &parcel); 105 std::string ToJson(); 106 void FromJson(const std::string &value); 107 void GetProfileJson(nlohmann::json &jsonObject) const; 108 109 private: 110 int32_t id_; 111 std::string name_; 112 std::vector<NotificationBundleOption> trustList_; 113 }; 114 } // namespace Notification 115 } // namespace OHOS 116 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_DO_NOT_DISTURB_PROFILE_H 117