github.com/benoitkugler/goacve@v0.0.0-20201217100549-151ce6e55dc8/server/core/rawdata/messages.go (about) 1 package rawdata 2 3 // MessageKind détermine la catégorie de l'échange 4 type MessageKind uint8 5 6 var colors = [...]HexColor{ 7 MSupprime: "#99808080", 8 MResponsable: "#993cff3c", 9 MCentre: "#9926c626", 10 MAccuseReception: "#994848c1", 11 MFacture: "#99ea8a1f", 12 MDocuments: "#9933def5", 13 MFactureAcquittee: "#99ead34c", 14 MAttestationPresence: "#99ead34c", 15 MSondage: "#99dc24ca", 16 MInscription: "#996565ee", 17 MPlaceLiberee: "#99f9ff1c", 18 MPaiement: "#99ad9726", 19 } 20 21 func (m MessageKind) String() string { 22 if int(m) < len(MessageKindLabels) { 23 return MessageKindLabels[m] 24 } 25 return "Catégorie inconnue" 26 } 27 28 func (m MessageKind) Color() HexColor { 29 if int(m) < len(colors) { 30 return colors[m] 31 } 32 return "" 33 } 34 35 func (m MessageKind) MailTitle() string { 36 switch m { 37 case MCentre, MAccuseReception, MFacture, MDocuments, MFactureAcquittee, MAttestationPresence, MSondage, MPlaceLiberee: 38 return m.String() 39 default: 40 return "" 41 } 42 }