196279301Sopenharmony_ci/* 296279301Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd. 396279301Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 496279301Sopenharmony_ci * you may not use this file except in compliance with the License. 596279301Sopenharmony_ci * You may obtain a copy of the License at 696279301Sopenharmony_ci * 796279301Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 896279301Sopenharmony_ci * 996279301Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1096279301Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1196279301Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1296279301Sopenharmony_ci * See the License for the specific language governing permissions and 1396279301Sopenharmony_ci * limitations under the License. 1496279301Sopenharmony_ci */ 1596279301Sopenharmony_ci 1696279301Sopenharmony_ci#ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_TIME_H 1796279301Sopenharmony_ci#define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_TIME_H 1896279301Sopenharmony_ci 1996279301Sopenharmony_ci#include "notification_json_convert.h" 2096279301Sopenharmony_ci#include "parcel.h" 2196279301Sopenharmony_ci#include <cstdint> 2296279301Sopenharmony_ci#include <string> 2396279301Sopenharmony_ci 2496279301Sopenharmony_cinamespace OHOS { 2596279301Sopenharmony_cinamespace Notification { 2696279301Sopenharmony_ciclass NotificationTime : public Parcelable, public NotificationJsonConvertionBase { 2796279301Sopenharmony_cipublic: 2896279301Sopenharmony_ci NotificationTime() = default; 2996279301Sopenharmony_ci 3096279301Sopenharmony_ci ~NotificationTime() = default; 3196279301Sopenharmony_ci 3296279301Sopenharmony_ci /** 3396279301Sopenharmony_ci * @brief Obtains the initialTime. 3496279301Sopenharmony_ci * 3596279301Sopenharmony_ci * @return Returns the initialTime. 3696279301Sopenharmony_ci */ 3796279301Sopenharmony_ci int32_t GetInitialTime() const; 3896279301Sopenharmony_ci 3996279301Sopenharmony_ci void SetInitialTime(int32_t time); 4096279301Sopenharmony_ci 4196279301Sopenharmony_ci /** 4296279301Sopenharmony_ci * @brief Obtains isCountDown flag. 4396279301Sopenharmony_ci * 4496279301Sopenharmony_ci * @return Returns the isCountDown flag. 4596279301Sopenharmony_ci */ 4696279301Sopenharmony_ci bool GetIsCountDown() const; 4796279301Sopenharmony_ci 4896279301Sopenharmony_ci void SetIsCountDown(bool flag); 4996279301Sopenharmony_ci 5096279301Sopenharmony_ci /** 5196279301Sopenharmony_ci * @brief Obtains isPaused flag. 5296279301Sopenharmony_ci * 5396279301Sopenharmony_ci * @return Returns the isPaused flag. 5496279301Sopenharmony_ci */ 5596279301Sopenharmony_ci bool GetIsPaused() const; 5696279301Sopenharmony_ci 5796279301Sopenharmony_ci void SetIsPaused(bool flag); 5896279301Sopenharmony_ci 5996279301Sopenharmony_ci /** 6096279301Sopenharmony_ci * @brief Obtains isInTitle flag. 6196279301Sopenharmony_ci * 6296279301Sopenharmony_ci * @return Returns the isInTitle flag. 6396279301Sopenharmony_ci */ 6496279301Sopenharmony_ci bool GetIsInTitle() const; 6596279301Sopenharmony_ci 6696279301Sopenharmony_ci void SetIsInTitle(bool flag); 6796279301Sopenharmony_ci 6896279301Sopenharmony_ci /** 6996279301Sopenharmony_ci * @brief Returns a string representation of the object. 7096279301Sopenharmony_ci * 7196279301Sopenharmony_ci * @return Returns a string representation of the object. 7296279301Sopenharmony_ci */ 7396279301Sopenharmony_ci std::string Dump(); 7496279301Sopenharmony_ci 7596279301Sopenharmony_ci /** 7696279301Sopenharmony_ci * @brief Converts a NotificationTime object into a Json. 7796279301Sopenharmony_ci * 7896279301Sopenharmony_ci * @param jsonObject Indicates the Json object. 7996279301Sopenharmony_ci * @return Returns true if succeed; returns false otherwise. 8096279301Sopenharmony_ci */ 8196279301Sopenharmony_ci bool ToJson(nlohmann::json &jsonObject) const override; 8296279301Sopenharmony_ci 8396279301Sopenharmony_ci /** 8496279301Sopenharmony_ci * @brief Creates a NotificationTime object from a Json. 8596279301Sopenharmony_ci * 8696279301Sopenharmony_ci * @param jsonObject Indicates the Json object. 8796279301Sopenharmony_ci * @return Returns the NotificationConversationalMessage. 8896279301Sopenharmony_ci */ 8996279301Sopenharmony_ci static NotificationTime *FromJson(const nlohmann::json &jsonObject); 9096279301Sopenharmony_ci 9196279301Sopenharmony_ci /** 9296279301Sopenharmony_ci * @brief Marshal a object into a Parcel. 9396279301Sopenharmony_ci * 9496279301Sopenharmony_ci * @param parcel Indicates the object into the parcel. 9596279301Sopenharmony_ci * @return Returns true if succeed; returns false otherwise. 9696279301Sopenharmony_ci */ 9796279301Sopenharmony_ci virtual bool Marshalling(Parcel &parcel) const override; 9896279301Sopenharmony_ci 9996279301Sopenharmony_ci /** 10096279301Sopenharmony_ci * @brief Unmarshal object from a Parcel. 10196279301Sopenharmony_ci * 10296279301Sopenharmony_ci * @param parcel Indicates the parcel object. 10396279301Sopenharmony_ci * @return Returns the NotificationTime. 10496279301Sopenharmony_ci */ 10596279301Sopenharmony_ci static NotificationTime *Unmarshalling(Parcel &parcel); 10696279301Sopenharmony_ci 10796279301Sopenharmony_ciprivate: 10896279301Sopenharmony_ci /** 10996279301Sopenharmony_ci * @brief Read a NotificationTime object from a Parcel. 11096279301Sopenharmony_ci * 11196279301Sopenharmony_ci * @param parcel Indicates the parcel object. 11296279301Sopenharmony_ci * @return Returns true if succeed; returns false otherwise. 11396279301Sopenharmony_ci */ 11496279301Sopenharmony_ci bool ReadFromParcel(Parcel &parcel); 11596279301Sopenharmony_ci 11696279301Sopenharmony_ciprivate: 11796279301Sopenharmony_ci int32_t initialTime_ {0}; 11896279301Sopenharmony_ci bool isCountDown_ {false}; 11996279301Sopenharmony_ci bool isPaused_ {false}; 12096279301Sopenharmony_ci bool isInTitle_ {false}; 12196279301Sopenharmony_ci}; 12296279301Sopenharmony_ci} // namespace Notification 12396279301Sopenharmony_ci} // namespace OHOS 12496279301Sopenharmony_ci 12596279301Sopenharmony_ci#endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_TIME_H