-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsteps.go
46 lines (36 loc) · 815 Bytes
/
steps.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
package main
import "fmt"
type voiceAssistant struct {
next step
}
func (v *voiceAssistant) run(cust *customer) {
fmt.Println("[Voice Assistant] Serving the customer: ", cust.name)
v.next.run(cust)
}
func (v *voiceAssistant) setNextStep(next step) {
v.next = next
}
type associate struct {
next step
}
func (a *associate) run(cust *customer) {
if cust.isHighPriority {
fmt.Println("Redirecting customer directly to manager")
a.next.run(cust)
return
}
fmt.Println("[Associate] Serving the customer: ", cust.name)
a.next.run(cust)
}
func (a *associate) setNextStep(next step) {
a.next = next
}
type manager struct {
next step
}
func (a *manager) run(cust *customer) {
fmt.Println("[Manager] Serving the customer: ", cust.name)
}
func (a *manager) setNextStep(next step) {
a.next = next
}