File size: 668 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
package notification

import (
	"github.com/google/uuid"
	"github.com/target/goalert/gadb"
)

type ProviderMessageID = gadb.ProviderMessageID

type DestID struct {
	// CMID is the ID of the user contact method.
	CMID uuid.NullUUID
	// NCID is the ID of the notification channel.
	NCID uuid.NullUUID
}

func (d DestID) IsUserCM() bool { return d.CMID.Valid }
func (d DestID) String() string {
	switch {
	case d.CMID.Valid:
		return d.CMID.UUID.String()
	case d.NCID.Valid:
		return d.NCID.UUID.String()
	}
	return ""
}

func (d DestID) UUID() uuid.UUID {
	switch {
	case d.CMID.Valid:
		return d.CMID.UUID
	case d.NCID.Valid:
		return d.NCID.UUID
	}
	return uuid.Nil
}