-
Notifications
You must be signed in to change notification settings - Fork 13
/
workplan.go
456 lines (286 loc) · 16.9 KB
/
workplan.go
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
package platformclientv2
import (
"github.com/leekchan/timeutil"
"encoding/json"
"strconv"
"strings"
)
// Workplan - Work plan information
type Workplan struct {
// Id - The globally unique identifier for the object.
Id *string `json:"id,omitempty"`
// Name
Name *string `json:"name,omitempty"`
// Enabled - Whether the work plan is enabled for scheduling
Enabled *bool `json:"enabled,omitempty"`
// Valid - Whether the work plan is valid or not
Valid *bool `json:"valid,omitempty"`
// ConstrainWeeklyPaidTime - Whether the weekly paid time constraint is enabled for this work plan
ConstrainWeeklyPaidTime *bool `json:"constrainWeeklyPaidTime,omitempty"`
// FlexibleWeeklyPaidTime - Whether the weekly paid time constraint is flexible for this work plan
FlexibleWeeklyPaidTime *bool `json:"flexibleWeeklyPaidTime,omitempty"`
// WeeklyExactPaidMinutes - Exact weekly paid time in minutes for this work plan. Used if flexibleWeeklyPaidTime == false
WeeklyExactPaidMinutes *int `json:"weeklyExactPaidMinutes,omitempty"`
// WeeklyMinimumPaidMinutes - Minimum weekly paid time in minutes for this work plan. Used if flexibleWeeklyPaidTime == true
WeeklyMinimumPaidMinutes *int `json:"weeklyMinimumPaidMinutes,omitempty"`
// WeeklyMaximumPaidMinutes - Maximum weekly paid time in minutes for this work plan. Used if flexibleWeeklyPaidTime == true
WeeklyMaximumPaidMinutes *int `json:"weeklyMaximumPaidMinutes,omitempty"`
// ConstrainPaidTimeGranularity - Whether paid time granularity is constrained for this work plan
ConstrainPaidTimeGranularity *bool `json:"constrainPaidTimeGranularity,omitempty"`
// PaidTimeGranularityMinutes - Granularity in minutes allowed for shift paid time in this work plan. Used if constrainPaidTimeGranularity == true
PaidTimeGranularityMinutes *int `json:"paidTimeGranularityMinutes,omitempty"`
// ConstrainMinimumTimeBetweenShifts - Whether the minimum time between shifts constraint is enabled for this work plan
ConstrainMinimumTimeBetweenShifts *bool `json:"constrainMinimumTimeBetweenShifts,omitempty"`
// MinimumTimeBetweenShiftsMinutes - Minimum time between shifts in minutes defined in this work plan. Used if constrainMinimumTimeBetweenShifts == true
MinimumTimeBetweenShiftsMinutes *int `json:"minimumTimeBetweenShiftsMinutes,omitempty"`
// MaximumDays - Maximum number days in a week allowed to be scheduled for this work plan
MaximumDays *int `json:"maximumDays,omitempty"`
// MinimumConsecutiveNonWorkingMinutesPerWeek - Minimum amount of consecutive non working minutes per week that agents who are assigned this work plan are allowed to have off
MinimumConsecutiveNonWorkingMinutesPerWeek *int `json:"minimumConsecutiveNonWorkingMinutesPerWeek,omitempty"`
// ConstrainMaximumConsecutiveWorkingWeekends - Whether to constrain the maximum consecutive working weekends
ConstrainMaximumConsecutiveWorkingWeekends *bool `json:"constrainMaximumConsecutiveWorkingWeekends,omitempty"`
// MaximumConsecutiveWorkingWeekends - The maximum number of consecutive weekends that agents who are assigned to this work plan are allowed to work
MaximumConsecutiveWorkingWeekends *int `json:"maximumConsecutiveWorkingWeekends,omitempty"`
// MinimumWorkingDaysPerWeek - The minimum number of days that agents assigned to a work plan must work per week
MinimumWorkingDaysPerWeek *int `json:"minimumWorkingDaysPerWeek,omitempty"`
// ConstrainMaximumConsecutiveWorkingDays - Whether to constrain the maximum consecutive working days
ConstrainMaximumConsecutiveWorkingDays *bool `json:"constrainMaximumConsecutiveWorkingDays,omitempty"`
// MaximumConsecutiveWorkingDays - The maximum number of consecutive days that agents assigned to this work plan are allowed to work. Used if constrainMaximumConsecutiveWorkingDays == true
MaximumConsecutiveWorkingDays *int `json:"maximumConsecutiveWorkingDays,omitempty"`
// MinimumShiftStartDistanceMinutes - The time period in minutes for the duration between the start times of two consecutive working days
MinimumShiftStartDistanceMinutes *int `json:"minimumShiftStartDistanceMinutes,omitempty"`
// MinimumDaysOffPerPlanningPeriod - Minimum days off in the planning period
MinimumDaysOffPerPlanningPeriod *int `json:"minimumDaysOffPerPlanningPeriod,omitempty"`
// MaximumDaysOffPerPlanningPeriod - Maximum days off in the planning period
MaximumDaysOffPerPlanningPeriod *int `json:"maximumDaysOffPerPlanningPeriod,omitempty"`
// MinimumPaidMinutesPerPlanningPeriod - Minimum paid minutes in the planning period
MinimumPaidMinutesPerPlanningPeriod *int `json:"minimumPaidMinutesPerPlanningPeriod,omitempty"`
// MaximumPaidMinutesPerPlanningPeriod - Maximum paid minutes in the planning period
MaximumPaidMinutesPerPlanningPeriod *int `json:"maximumPaidMinutesPerPlanningPeriod,omitempty"`
// OptionalDays - Optional days to schedule for this work plan
OptionalDays *Setwrapperdayofweek `json:"optionalDays,omitempty"`
// ShiftStartVarianceType - This constraint ensures that an agent starts each workday within a user-defined time threshold
ShiftStartVarianceType *string `json:"shiftStartVarianceType,omitempty"`
// ShiftStartVariances - Variance in minutes among start times of shifts in this work plan
ShiftStartVariances *Listwrappershiftstartvariance `json:"shiftStartVariances,omitempty"`
// Shifts - Shifts in this work plan
Shifts *[]Workplanshift `json:"shifts,omitempty"`
// Agents - Agents in this work plan
Agents *[]Deletableuserreference `json:"agents,omitempty"`
// AgentCount - Number of agents in this work plan
AgentCount *int `json:"agentCount,omitempty"`
// Metadata - Version metadata for this work plan
Metadata *Wfmversionedentitymetadata `json:"metadata,omitempty"`
// SelfUri - The URI for this object
SelfUri *string `json:"selfUri,omitempty"`
}
func (o *Workplan) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Workplan
return json.Marshal(&struct {
Id *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Valid *bool `json:"valid,omitempty"`
ConstrainWeeklyPaidTime *bool `json:"constrainWeeklyPaidTime,omitempty"`
FlexibleWeeklyPaidTime *bool `json:"flexibleWeeklyPaidTime,omitempty"`
WeeklyExactPaidMinutes *int `json:"weeklyExactPaidMinutes,omitempty"`
WeeklyMinimumPaidMinutes *int `json:"weeklyMinimumPaidMinutes,omitempty"`
WeeklyMaximumPaidMinutes *int `json:"weeklyMaximumPaidMinutes,omitempty"`
ConstrainPaidTimeGranularity *bool `json:"constrainPaidTimeGranularity,omitempty"`
PaidTimeGranularityMinutes *int `json:"paidTimeGranularityMinutes,omitempty"`
ConstrainMinimumTimeBetweenShifts *bool `json:"constrainMinimumTimeBetweenShifts,omitempty"`
MinimumTimeBetweenShiftsMinutes *int `json:"minimumTimeBetweenShiftsMinutes,omitempty"`
MaximumDays *int `json:"maximumDays,omitempty"`
MinimumConsecutiveNonWorkingMinutesPerWeek *int `json:"minimumConsecutiveNonWorkingMinutesPerWeek,omitempty"`
ConstrainMaximumConsecutiveWorkingWeekends *bool `json:"constrainMaximumConsecutiveWorkingWeekends,omitempty"`
MaximumConsecutiveWorkingWeekends *int `json:"maximumConsecutiveWorkingWeekends,omitempty"`
MinimumWorkingDaysPerWeek *int `json:"minimumWorkingDaysPerWeek,omitempty"`
ConstrainMaximumConsecutiveWorkingDays *bool `json:"constrainMaximumConsecutiveWorkingDays,omitempty"`
MaximumConsecutiveWorkingDays *int `json:"maximumConsecutiveWorkingDays,omitempty"`
MinimumShiftStartDistanceMinutes *int `json:"minimumShiftStartDistanceMinutes,omitempty"`
MinimumDaysOffPerPlanningPeriod *int `json:"minimumDaysOffPerPlanningPeriod,omitempty"`
MaximumDaysOffPerPlanningPeriod *int `json:"maximumDaysOffPerPlanningPeriod,omitempty"`
MinimumPaidMinutesPerPlanningPeriod *int `json:"minimumPaidMinutesPerPlanningPeriod,omitempty"`
MaximumPaidMinutesPerPlanningPeriod *int `json:"maximumPaidMinutesPerPlanningPeriod,omitempty"`
OptionalDays *Setwrapperdayofweek `json:"optionalDays,omitempty"`
ShiftStartVarianceType *string `json:"shiftStartVarianceType,omitempty"`
ShiftStartVariances *Listwrappershiftstartvariance `json:"shiftStartVariances,omitempty"`
Shifts *[]Workplanshift `json:"shifts,omitempty"`
Agents *[]Deletableuserreference `json:"agents,omitempty"`
AgentCount *int `json:"agentCount,omitempty"`
Metadata *Wfmversionedentitymetadata `json:"metadata,omitempty"`
SelfUri *string `json:"selfUri,omitempty"`
*Alias
}{
Id: o.Id,
Name: o.Name,
Enabled: o.Enabled,
Valid: o.Valid,
ConstrainWeeklyPaidTime: o.ConstrainWeeklyPaidTime,
FlexibleWeeklyPaidTime: o.FlexibleWeeklyPaidTime,
WeeklyExactPaidMinutes: o.WeeklyExactPaidMinutes,
WeeklyMinimumPaidMinutes: o.WeeklyMinimumPaidMinutes,
WeeklyMaximumPaidMinutes: o.WeeklyMaximumPaidMinutes,
ConstrainPaidTimeGranularity: o.ConstrainPaidTimeGranularity,
PaidTimeGranularityMinutes: o.PaidTimeGranularityMinutes,
ConstrainMinimumTimeBetweenShifts: o.ConstrainMinimumTimeBetweenShifts,
MinimumTimeBetweenShiftsMinutes: o.MinimumTimeBetweenShiftsMinutes,
MaximumDays: o.MaximumDays,
MinimumConsecutiveNonWorkingMinutesPerWeek: o.MinimumConsecutiveNonWorkingMinutesPerWeek,
ConstrainMaximumConsecutiveWorkingWeekends: o.ConstrainMaximumConsecutiveWorkingWeekends,
MaximumConsecutiveWorkingWeekends: o.MaximumConsecutiveWorkingWeekends,
MinimumWorkingDaysPerWeek: o.MinimumWorkingDaysPerWeek,
ConstrainMaximumConsecutiveWorkingDays: o.ConstrainMaximumConsecutiveWorkingDays,
MaximumConsecutiveWorkingDays: o.MaximumConsecutiveWorkingDays,
MinimumShiftStartDistanceMinutes: o.MinimumShiftStartDistanceMinutes,
MinimumDaysOffPerPlanningPeriod: o.MinimumDaysOffPerPlanningPeriod,
MaximumDaysOffPerPlanningPeriod: o.MaximumDaysOffPerPlanningPeriod,
MinimumPaidMinutesPerPlanningPeriod: o.MinimumPaidMinutesPerPlanningPeriod,
MaximumPaidMinutesPerPlanningPeriod: o.MaximumPaidMinutesPerPlanningPeriod,
OptionalDays: o.OptionalDays,
ShiftStartVarianceType: o.ShiftStartVarianceType,
ShiftStartVariances: o.ShiftStartVariances,
Shifts: o.Shifts,
Agents: o.Agents,
AgentCount: o.AgentCount,
Metadata: o.Metadata,
SelfUri: o.SelfUri,
Alias: (*Alias)(o),
})
}
func (o *Workplan) UnmarshalJSON(b []byte) error {
var WorkplanMap map[string]interface{}
err := json.Unmarshal(b, &WorkplanMap)
if err != nil {
return err
}
if Id, ok := WorkplanMap["id"].(string); ok {
o.Id = &Id
}
if Name, ok := WorkplanMap["name"].(string); ok {
o.Name = &Name
}
if Enabled, ok := WorkplanMap["enabled"].(bool); ok {
o.Enabled = &Enabled
}
if Valid, ok := WorkplanMap["valid"].(bool); ok {
o.Valid = &Valid
}
if ConstrainWeeklyPaidTime, ok := WorkplanMap["constrainWeeklyPaidTime"].(bool); ok {
o.ConstrainWeeklyPaidTime = &ConstrainWeeklyPaidTime
}
if FlexibleWeeklyPaidTime, ok := WorkplanMap["flexibleWeeklyPaidTime"].(bool); ok {
o.FlexibleWeeklyPaidTime = &FlexibleWeeklyPaidTime
}
if WeeklyExactPaidMinutes, ok := WorkplanMap["weeklyExactPaidMinutes"].(float64); ok {
WeeklyExactPaidMinutesInt := int(WeeklyExactPaidMinutes)
o.WeeklyExactPaidMinutes = &WeeklyExactPaidMinutesInt
}
if WeeklyMinimumPaidMinutes, ok := WorkplanMap["weeklyMinimumPaidMinutes"].(float64); ok {
WeeklyMinimumPaidMinutesInt := int(WeeklyMinimumPaidMinutes)
o.WeeklyMinimumPaidMinutes = &WeeklyMinimumPaidMinutesInt
}
if WeeklyMaximumPaidMinutes, ok := WorkplanMap["weeklyMaximumPaidMinutes"].(float64); ok {
WeeklyMaximumPaidMinutesInt := int(WeeklyMaximumPaidMinutes)
o.WeeklyMaximumPaidMinutes = &WeeklyMaximumPaidMinutesInt
}
if ConstrainPaidTimeGranularity, ok := WorkplanMap["constrainPaidTimeGranularity"].(bool); ok {
o.ConstrainPaidTimeGranularity = &ConstrainPaidTimeGranularity
}
if PaidTimeGranularityMinutes, ok := WorkplanMap["paidTimeGranularityMinutes"].(float64); ok {
PaidTimeGranularityMinutesInt := int(PaidTimeGranularityMinutes)
o.PaidTimeGranularityMinutes = &PaidTimeGranularityMinutesInt
}
if ConstrainMinimumTimeBetweenShifts, ok := WorkplanMap["constrainMinimumTimeBetweenShifts"].(bool); ok {
o.ConstrainMinimumTimeBetweenShifts = &ConstrainMinimumTimeBetweenShifts
}
if MinimumTimeBetweenShiftsMinutes, ok := WorkplanMap["minimumTimeBetweenShiftsMinutes"].(float64); ok {
MinimumTimeBetweenShiftsMinutesInt := int(MinimumTimeBetweenShiftsMinutes)
o.MinimumTimeBetweenShiftsMinutes = &MinimumTimeBetweenShiftsMinutesInt
}
if MaximumDays, ok := WorkplanMap["maximumDays"].(float64); ok {
MaximumDaysInt := int(MaximumDays)
o.MaximumDays = &MaximumDaysInt
}
if MinimumConsecutiveNonWorkingMinutesPerWeek, ok := WorkplanMap["minimumConsecutiveNonWorkingMinutesPerWeek"].(float64); ok {
MinimumConsecutiveNonWorkingMinutesPerWeekInt := int(MinimumConsecutiveNonWorkingMinutesPerWeek)
o.MinimumConsecutiveNonWorkingMinutesPerWeek = &MinimumConsecutiveNonWorkingMinutesPerWeekInt
}
if ConstrainMaximumConsecutiveWorkingWeekends, ok := WorkplanMap["constrainMaximumConsecutiveWorkingWeekends"].(bool); ok {
o.ConstrainMaximumConsecutiveWorkingWeekends = &ConstrainMaximumConsecutiveWorkingWeekends
}
if MaximumConsecutiveWorkingWeekends, ok := WorkplanMap["maximumConsecutiveWorkingWeekends"].(float64); ok {
MaximumConsecutiveWorkingWeekendsInt := int(MaximumConsecutiveWorkingWeekends)
o.MaximumConsecutiveWorkingWeekends = &MaximumConsecutiveWorkingWeekendsInt
}
if MinimumWorkingDaysPerWeek, ok := WorkplanMap["minimumWorkingDaysPerWeek"].(float64); ok {
MinimumWorkingDaysPerWeekInt := int(MinimumWorkingDaysPerWeek)
o.MinimumWorkingDaysPerWeek = &MinimumWorkingDaysPerWeekInt
}
if ConstrainMaximumConsecutiveWorkingDays, ok := WorkplanMap["constrainMaximumConsecutiveWorkingDays"].(bool); ok {
o.ConstrainMaximumConsecutiveWorkingDays = &ConstrainMaximumConsecutiveWorkingDays
}
if MaximumConsecutiveWorkingDays, ok := WorkplanMap["maximumConsecutiveWorkingDays"].(float64); ok {
MaximumConsecutiveWorkingDaysInt := int(MaximumConsecutiveWorkingDays)
o.MaximumConsecutiveWorkingDays = &MaximumConsecutiveWorkingDaysInt
}
if MinimumShiftStartDistanceMinutes, ok := WorkplanMap["minimumShiftStartDistanceMinutes"].(float64); ok {
MinimumShiftStartDistanceMinutesInt := int(MinimumShiftStartDistanceMinutes)
o.MinimumShiftStartDistanceMinutes = &MinimumShiftStartDistanceMinutesInt
}
if MinimumDaysOffPerPlanningPeriod, ok := WorkplanMap["minimumDaysOffPerPlanningPeriod"].(float64); ok {
MinimumDaysOffPerPlanningPeriodInt := int(MinimumDaysOffPerPlanningPeriod)
o.MinimumDaysOffPerPlanningPeriod = &MinimumDaysOffPerPlanningPeriodInt
}
if MaximumDaysOffPerPlanningPeriod, ok := WorkplanMap["maximumDaysOffPerPlanningPeriod"].(float64); ok {
MaximumDaysOffPerPlanningPeriodInt := int(MaximumDaysOffPerPlanningPeriod)
o.MaximumDaysOffPerPlanningPeriod = &MaximumDaysOffPerPlanningPeriodInt
}
if MinimumPaidMinutesPerPlanningPeriod, ok := WorkplanMap["minimumPaidMinutesPerPlanningPeriod"].(float64); ok {
MinimumPaidMinutesPerPlanningPeriodInt := int(MinimumPaidMinutesPerPlanningPeriod)
o.MinimumPaidMinutesPerPlanningPeriod = &MinimumPaidMinutesPerPlanningPeriodInt
}
if MaximumPaidMinutesPerPlanningPeriod, ok := WorkplanMap["maximumPaidMinutesPerPlanningPeriod"].(float64); ok {
MaximumPaidMinutesPerPlanningPeriodInt := int(MaximumPaidMinutesPerPlanningPeriod)
o.MaximumPaidMinutesPerPlanningPeriod = &MaximumPaidMinutesPerPlanningPeriodInt
}
if OptionalDays, ok := WorkplanMap["optionalDays"].(map[string]interface{}); ok {
OptionalDaysString, _ := json.Marshal(OptionalDays)
json.Unmarshal(OptionalDaysString, &o.OptionalDays)
}
if ShiftStartVarianceType, ok := WorkplanMap["shiftStartVarianceType"].(string); ok {
o.ShiftStartVarianceType = &ShiftStartVarianceType
}
if ShiftStartVariances, ok := WorkplanMap["shiftStartVariances"].(map[string]interface{}); ok {
ShiftStartVariancesString, _ := json.Marshal(ShiftStartVariances)
json.Unmarshal(ShiftStartVariancesString, &o.ShiftStartVariances)
}
if Shifts, ok := WorkplanMap["shifts"].([]interface{}); ok {
ShiftsString, _ := json.Marshal(Shifts)
json.Unmarshal(ShiftsString, &o.Shifts)
}
if Agents, ok := WorkplanMap["agents"].([]interface{}); ok {
AgentsString, _ := json.Marshal(Agents)
json.Unmarshal(AgentsString, &o.Agents)
}
if AgentCount, ok := WorkplanMap["agentCount"].(float64); ok {
AgentCountInt := int(AgentCount)
o.AgentCount = &AgentCountInt
}
if Metadata, ok := WorkplanMap["metadata"].(map[string]interface{}); ok {
MetadataString, _ := json.Marshal(Metadata)
json.Unmarshal(MetadataString, &o.Metadata)
}
if SelfUri, ok := WorkplanMap["selfUri"].(string); ok {
o.SelfUri = &SelfUri
}
return nil
}
// String returns a JSON representation of the model
func (o *Workplan) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
}