/var/www/html_uk/wp-content/plugins/automatewoo/includes/Rest_Api/Schema/LogSchema.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?php

namespace AutomateWoo\Rest_Api\Schema;

defined'ABSPATH' ) || exit;

trait 
LogSchema {

    
/**
     * Retrieves the item's schema, conforming to JSON Schema.
     *
     * @return array Item schema data.
     */
    
public function get_item_schema() {
        
$schema = [
            
'$schema'    => 'https://json-schema.org/draft-04/schema#',
            
'title'      => 'logs',
            
'type'       => 'object',
            
'properties' => [
                
'id'                             => [
                    
'description' => __'Unique identifier for the object.''automatewoo' ),
                    
'type'        => 'integer',
                    
'context'     => Context::VIEW_ONLY,
                    
'readonly'    => true,
                ],
                
'workflow'                       => [
                    
'description' => __'Workflow data for the log.''automatewoo' ),
                    
'type'        => 'object',
                    
'context'     => Context::VIEW_ONLY,
                    
'properties'  => [
                        
'id'    => [
                            
'description' => __'The Workflow ID.''automatewoo' ),
                            
'type'        => 'integer',
                            
'context'     => Context::VIEW_ONLY,
                            
'readonly'    => true,
                        ],
                        
'title' => [
                            
'description' => __'The title of the workflow.''automatewoo' ),
                            
'type'        => 'string',
                            
'context'     => Context::VIEW_ONLY,
                        ],
                    ],
                ],
                
'customer'                       => [
                    
'description' => __'Customer data for the log.''automatewoo' ),
                    
'type'        => 'object',
                    
'context'     => Context::VIEW_ONLY,
                    
'properties'  => [
                        
'id'      => [
                            
'description' => __'The Customer ID within AutomateWoo.''automatewoo' ),
                            
'type'        => 'integer',
                            
'context'     => Context::VIEW_ONLY,
                            
'readonly'    => true,
                        ],
                        
'email'   => [
                            
'description' => __'The customer email address.''automatewoo' ),
                            
'type'        => 'string',
                            
'context'     => Context::VIEW_ONLY,
                        ],
                        
'name'    => [
                            
'description' => __"The customer's full name."'automatewoo' ),
                            
'type'        => 'string',
                            
'context'     => Context::VIEW_ONLY,
                        ],
                        
'user_id' => [
                            
'description' => __'The WordPress User ID for the customer.''automatewoo' ),
                            
'type'        => 'integer',
                            
'context'     => Context::VIEW_ONLY,
                            
'readonly'    => true,
                        ],
                    ],
                ],
                
'date'                           => [
                    
'description' => __'The date of the log.''automatewoo' ),
                    
'type'        => 'string',
                    
'format'      => 'date-time',
                    
'context'     => Context::VIEW_ONLY,
                ],
                
'has_errors'                     => [
                    
'description' => __'Whether the workflow generated errors.''automatewoo' ),
                    
'type'        => 'boolean',
                    
'context'     => Context::VIEW_ONLY,
                ],
                
'has_blocked_emails'             => [
                    
'description' => __'Whether the workflow had blocked emails.''automatewoo' ),
                    
'type'        => 'boolean',
                    
'context'     => Context::VIEW_ONLY,
                ],
                
'is_tracking_enabled'            => [
                    
'description' => __'Whether the workflow has tracking enabled.''automatewoo' ),
                    
'type'        => 'boolean',
                    
'context'     => Context::VIEW_ONLY,
                ],
                
'is_conversion_tracking_enabled' => [
                    
'description' => __'Whether the workflow has conversion tracking enabled,''automatewoo' ),
                    
'type'        => 'boolean',
                    
'context'     => Context::VIEW_ONLY,
                ],
                
'is_anonymized'                  => [
                    
'description' => __'Whether the user data is anonymized.''automatewoo' ),
                    
'type'        => 'boolean',
                    
'context'     => Context::VIEW_ONLY,
                ],
                
'has_open_recorded'              => [
                    
'description' => __'Whether an open has been recorded.''automatewoo' ),
                    
'type'        => 'boolean',
                    
'context'     => Context::VIEW_ONLY,
                ],
                
'has_click_recorded'             => [
                    
'description' => __'Whether a click has been recorded.''automatewoo' ),
                    
'type'        => 'boolean',
                    
'context'     => Context::VIEW_ONLY,
                ],
                
'date_opened'                    => [
                    
'description' => __'The date the open was recorded.''automatewoo' ),
                    
'type'        => 'string',
                    
'format'      => 'date-time',
                    
'context'     => Context::VIEW_ONLY,
                ],
                
'date_clicked'                   => [
                    
'description' => __'The date the click was recorded.''automatewoo' ),
                    
'type'        => 'string',
                    
'format'      => 'date-time',
                    
'context'     => Context::VIEW_ONLY,
                ],
                
'notes'                          => [
                    
'description' => __'Notes for the log.''automatewoo' ),
                    
'type'        => 'array',
                    
'items'       => [
                        
'type' => 'string',
                    ],
                    
'context'     => Context::VIEW_ONLY,
                ],
                
'order_id'                       => [
                    
'description' => __'The order ID for the log.''automatewoo' ),
                    
'type'        => 'integer',
                    
'context'     => Context::VIEW_ONLY,
                    
'readonly'    => true,
                ],
            ],
        ];

        return 
$this->add_additional_fields_schema$schema );
    }

    
/**
     * Adds the schema from additional fields to a schema array.
     *
     * The type of object is inferred from the passed schema.
     *
     * @param array $schema Schema array.
     *
     * @return array Modified Schema array.
     */
    
abstract protected function add_additional_fields_schema$schema );
}