Sync from Azure to LF
[ric-plt/resource-status-manager.git] / RSM / enums / message_direction.go
1 package enums
2
3 import (
4         "encoding/json"
5         "strconv"
6 )
7
8 type MessageDirection int32
9
10 var messageDirectionEnumName = map[int32]string{
11         0: "UNKNOWN_MESSAGE_DIRECTION",
12         1: "RAN_TO_RIC",
13         2: "RIC_TO_RAN",
14 }
15
16 const (
17         UNKNOWN_MESSAGE_DIRECTION MessageDirection = 0
18         RAN_TO_RIC                MessageDirection = 1
19         RIC_TO_RAN                MessageDirection = 2
20 )
21
22 func (md MessageDirection) String() string {
23         s, ok := messageDirectionEnumName[int32(md)]
24         if ok {
25                 return s
26         }
27         return strconv.Itoa(int(md))
28 }
29
30 func (md MessageDirection) MarshalJSON() ([]byte, error) {
31         _, ok := messageDirectionEnumName[int32(md)]
32
33         if !ok {
34                 return nil,&json.UnsupportedValueError{}
35         }
36
37         v:= int32(md)
38         return json.Marshal(v)
39 }