1 /*
2  * Copyright (c) 2023 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 PRINT_SECURITY_GUARD_INFO_H
17 #define PRINT_SECURITY_GUARD_INFO_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include <nlohmann/json.hpp>
23 
24 #ifdef SECURITY_GUARDE_ENABLE
25 #include "sg_collect_client.h"
26 #include "time_service_client.h"
27 #include "event_info.h"
28 #endif
29 
30 #include "print_security_guard_util.h"
31 #include "printer_info.h"
32 #include "print_job.h"
33 #include "print_constant.h"
34 
35 namespace OHOS::Print {
36 class PrintSecurityGuardInfo {
37 struct PrintTypeInfo {
38     int32_t port = 631;
39     int32_t copyNumber = 1;
40     int32_t printPages = 1;
41     std::string ip;
42     std::string mac;
43     std::string domain;
44     std::string name;
45 };
46 
47 public:
48     PrintSecurityGuardInfo(const std::string callPkg, const std::vector<std::string> &fileList);
49     std::string ToJsonStr();
50     void SetPrintTypeInfo(const PrinterInfo &printerInfo, const PrintJob &printJob);
51 
52 private:
53     int32_t subType_{};
54     std::string caller_{};
55     std::string objectInfo_{};
56     std::string outcome_{};
57     std::string bootTime_{};
58     std::string wallTime_{};
59     std::string targetInfo_{};
60     std::string sourceInfo_{};
61     std::string extra_{};
62     std::string jobName_{};
63     PrintTypeInfo printTypeInfo_;
64 
65     nlohmann::json ToJson();
66 };
67 } // namespace OHOS::Print
68 
69 #endif // PRINT_SECURITY_GUARD_INFO_H