github.com/cloudwan/edgelq-sdk@v1.15.4/devices/resources/v1/device_distribution_counter/device_distribution_counter.pb.fieldpath.go (about)

     1  // Code generated by protoc-gen-goten-object
     2  // File: edgelq/devices/proto/v1/device_distribution_counter.proto
     3  // DO NOT EDIT!!!
     4  
     5  package device_distribution_counter
     6  
     7  import (
     8  	"encoding/json"
     9  	"fmt"
    10  	"reflect"
    11  	"strings"
    12  	"time"
    13  
    14  	"google.golang.org/grpc/codes"
    15  	"google.golang.org/grpc/status"
    16  	"google.golang.org/protobuf/encoding/protojson"
    17  	"google.golang.org/protobuf/proto"
    18  	"google.golang.org/protobuf/reflect/protoregistry"
    19  
    20  	gotenobject "github.com/cloudwan/goten-sdk/runtime/object"
    21  	"github.com/cloudwan/goten-sdk/runtime/strcase"
    22  )
    23  
    24  // proto imports
    25  import (
    26  	project "github.com/cloudwan/edgelq-sdk/devices/resources/v1/project"
    27  	meta "github.com/cloudwan/goten-sdk/types/meta"
    28  )
    29  
    30  // ensure the imports are used
    31  var (
    32  	_ = new(json.Marshaler)
    33  	_ = new(fmt.Stringer)
    34  	_ = reflect.DeepEqual
    35  	_ = strings.Builder{}
    36  	_ = time.Second
    37  
    38  	_ = strcase.ToLowerCamel
    39  	_ = codes.NotFound
    40  	_ = status.Status{}
    41  	_ = protojson.UnmarshalOptions{}
    42  	_ = new(proto.Message)
    43  	_ = protoregistry.GlobalTypes
    44  
    45  	_ = new(gotenobject.FieldPath)
    46  )
    47  
    48  // make sure we're using proto imports
    49  var (
    50  	_ = &project.Project{}
    51  	_ = &meta.Meta{}
    52  )
    53  
    54  // FieldPath provides implementation to handle
    55  // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto
    56  type DeviceDistributionCounter_FieldPath interface {
    57  	gotenobject.FieldPath
    58  	Selector() DeviceDistributionCounter_FieldPathSelector
    59  	Get(source *DeviceDistributionCounter) []interface{}
    60  	GetSingle(source *DeviceDistributionCounter) (interface{}, bool)
    61  	ClearValue(item *DeviceDistributionCounter)
    62  
    63  	// Those methods build corresponding DeviceDistributionCounter_FieldPathValue
    64  	// (or array of values) and holds passed value. Panics if injected type is incorrect.
    65  	WithIValue(value interface{}) DeviceDistributionCounter_FieldPathValue
    66  	WithIArrayOfValues(values interface{}) DeviceDistributionCounter_FieldPathArrayOfValues
    67  	WithIArrayItemValue(value interface{}) DeviceDistributionCounter_FieldPathArrayItemValue
    68  }
    69  
    70  type DeviceDistributionCounter_FieldPathSelector int32
    71  
    72  const (
    73  	DeviceDistributionCounter_FieldPathSelectorName        DeviceDistributionCounter_FieldPathSelector = 0
    74  	DeviceDistributionCounter_FieldPathSelectorMetadata    DeviceDistributionCounter_FieldPathSelector = 1
    75  	DeviceDistributionCounter_FieldPathSelectorTotalCount  DeviceDistributionCounter_FieldPathSelector = 2
    76  	DeviceDistributionCounter_FieldPathSelectorOnlineCount DeviceDistributionCounter_FieldPathSelector = 3
    77  )
    78  
    79  func (s DeviceDistributionCounter_FieldPathSelector) String() string {
    80  	switch s {
    81  	case DeviceDistributionCounter_FieldPathSelectorName:
    82  		return "name"
    83  	case DeviceDistributionCounter_FieldPathSelectorMetadata:
    84  		return "metadata"
    85  	case DeviceDistributionCounter_FieldPathSelectorTotalCount:
    86  		return "total_count"
    87  	case DeviceDistributionCounter_FieldPathSelectorOnlineCount:
    88  		return "online_count"
    89  	default:
    90  		panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", s))
    91  	}
    92  }
    93  
    94  func BuildDeviceDistributionCounter_FieldPath(fp gotenobject.RawFieldPath) (DeviceDistributionCounter_FieldPath, error) {
    95  	if len(fp) == 0 {
    96  		return nil, status.Error(codes.InvalidArgument, "empty field path for object DeviceDistributionCounter")
    97  	}
    98  	if len(fp) == 1 {
    99  		switch fp[0] {
   100  		case "name":
   101  			return &DeviceDistributionCounter_FieldTerminalPath{selector: DeviceDistributionCounter_FieldPathSelectorName}, nil
   102  		case "metadata":
   103  			return &DeviceDistributionCounter_FieldTerminalPath{selector: DeviceDistributionCounter_FieldPathSelectorMetadata}, nil
   104  		case "total_count", "totalCount", "total-count":
   105  			return &DeviceDistributionCounter_FieldTerminalPath{selector: DeviceDistributionCounter_FieldPathSelectorTotalCount}, nil
   106  		case "online_count", "onlineCount", "online-count":
   107  			return &DeviceDistributionCounter_FieldTerminalPath{selector: DeviceDistributionCounter_FieldPathSelectorOnlineCount}, nil
   108  		}
   109  	} else {
   110  		switch fp[0] {
   111  		case "metadata":
   112  			if subpath, err := meta.BuildMeta_FieldPath(fp[1:]); err != nil {
   113  				return nil, err
   114  			} else {
   115  				return &DeviceDistributionCounter_FieldSubPath{selector: DeviceDistributionCounter_FieldPathSelectorMetadata, subPath: subpath}, nil
   116  			}
   117  		}
   118  	}
   119  	return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object DeviceDistributionCounter", fp)
   120  }
   121  
   122  func ParseDeviceDistributionCounter_FieldPath(rawField string) (DeviceDistributionCounter_FieldPath, error) {
   123  	fp, err := gotenobject.ParseRawFieldPath(rawField)
   124  	if err != nil {
   125  		return nil, err
   126  	}
   127  	return BuildDeviceDistributionCounter_FieldPath(fp)
   128  }
   129  
   130  func MustParseDeviceDistributionCounter_FieldPath(rawField string) DeviceDistributionCounter_FieldPath {
   131  	fp, err := ParseDeviceDistributionCounter_FieldPath(rawField)
   132  	if err != nil {
   133  		panic(err)
   134  	}
   135  	return fp
   136  }
   137  
   138  type DeviceDistributionCounter_FieldTerminalPath struct {
   139  	selector DeviceDistributionCounter_FieldPathSelector
   140  }
   141  
   142  var _ DeviceDistributionCounter_FieldPath = (*DeviceDistributionCounter_FieldTerminalPath)(nil)
   143  
   144  func (fp *DeviceDistributionCounter_FieldTerminalPath) Selector() DeviceDistributionCounter_FieldPathSelector {
   145  	return fp.selector
   146  }
   147  
   148  // String returns path representation in proto convention
   149  func (fp *DeviceDistributionCounter_FieldTerminalPath) String() string {
   150  	return fp.selector.String()
   151  }
   152  
   153  // JSONString returns path representation is JSON convention
   154  func (fp *DeviceDistributionCounter_FieldTerminalPath) JSONString() string {
   155  	return strcase.ToLowerCamel(fp.String())
   156  }
   157  
   158  // Get returns all values pointed by specific field from source DeviceDistributionCounter
   159  func (fp *DeviceDistributionCounter_FieldTerminalPath) Get(source *DeviceDistributionCounter) (values []interface{}) {
   160  	if source != nil {
   161  		switch fp.selector {
   162  		case DeviceDistributionCounter_FieldPathSelectorName:
   163  			if source.Name != nil {
   164  				values = append(values, source.Name)
   165  			}
   166  		case DeviceDistributionCounter_FieldPathSelectorMetadata:
   167  			if source.Metadata != nil {
   168  				values = append(values, source.Metadata)
   169  			}
   170  		case DeviceDistributionCounter_FieldPathSelectorTotalCount:
   171  			values = append(values, source.TotalCount)
   172  		case DeviceDistributionCounter_FieldPathSelectorOnlineCount:
   173  			values = append(values, source.OnlineCount)
   174  		default:
   175  			panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", fp.selector))
   176  		}
   177  	}
   178  	return
   179  }
   180  
   181  func (fp *DeviceDistributionCounter_FieldTerminalPath) GetRaw(source proto.Message) []interface{} {
   182  	return fp.Get(source.(*DeviceDistributionCounter))
   183  }
   184  
   185  // GetSingle returns value pointed by specific field of from source DeviceDistributionCounter
   186  func (fp *DeviceDistributionCounter_FieldTerminalPath) GetSingle(source *DeviceDistributionCounter) (interface{}, bool) {
   187  	switch fp.selector {
   188  	case DeviceDistributionCounter_FieldPathSelectorName:
   189  		res := source.GetName()
   190  		return res, res != nil
   191  	case DeviceDistributionCounter_FieldPathSelectorMetadata:
   192  		res := source.GetMetadata()
   193  		return res, res != nil
   194  	case DeviceDistributionCounter_FieldPathSelectorTotalCount:
   195  		return source.GetTotalCount(), source != nil
   196  	case DeviceDistributionCounter_FieldPathSelectorOnlineCount:
   197  		return source.GetOnlineCount(), source != nil
   198  	default:
   199  		panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", fp.selector))
   200  	}
   201  }
   202  
   203  func (fp *DeviceDistributionCounter_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) {
   204  	return fp.GetSingle(source.(*DeviceDistributionCounter))
   205  }
   206  
   207  // GetDefault returns a default value of the field type
   208  func (fp *DeviceDistributionCounter_FieldTerminalPath) GetDefault() interface{} {
   209  	switch fp.selector {
   210  	case DeviceDistributionCounter_FieldPathSelectorName:
   211  		return (*Name)(nil)
   212  	case DeviceDistributionCounter_FieldPathSelectorMetadata:
   213  		return (*meta.Meta)(nil)
   214  	case DeviceDistributionCounter_FieldPathSelectorTotalCount:
   215  		return int64(0)
   216  	case DeviceDistributionCounter_FieldPathSelectorOnlineCount:
   217  		return int64(0)
   218  	default:
   219  		panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", fp.selector))
   220  	}
   221  }
   222  
   223  func (fp *DeviceDistributionCounter_FieldTerminalPath) ClearValue(item *DeviceDistributionCounter) {
   224  	if item != nil {
   225  		switch fp.selector {
   226  		case DeviceDistributionCounter_FieldPathSelectorName:
   227  			item.Name = nil
   228  		case DeviceDistributionCounter_FieldPathSelectorMetadata:
   229  			item.Metadata = nil
   230  		case DeviceDistributionCounter_FieldPathSelectorTotalCount:
   231  			item.TotalCount = int64(0)
   232  		case DeviceDistributionCounter_FieldPathSelectorOnlineCount:
   233  			item.OnlineCount = int64(0)
   234  		default:
   235  			panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", fp.selector))
   236  		}
   237  	}
   238  }
   239  
   240  func (fp *DeviceDistributionCounter_FieldTerminalPath) ClearValueRaw(item proto.Message) {
   241  	fp.ClearValue(item.(*DeviceDistributionCounter))
   242  }
   243  
   244  // IsLeaf - whether field path is holds simple value
   245  func (fp *DeviceDistributionCounter_FieldTerminalPath) IsLeaf() bool {
   246  	return fp.selector == DeviceDistributionCounter_FieldPathSelectorName ||
   247  		fp.selector == DeviceDistributionCounter_FieldPathSelectorTotalCount ||
   248  		fp.selector == DeviceDistributionCounter_FieldPathSelectorOnlineCount
   249  }
   250  
   251  func (fp *DeviceDistributionCounter_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath {
   252  	return []gotenobject.FieldPath{fp}
   253  }
   254  
   255  func (fp *DeviceDistributionCounter_FieldTerminalPath) WithIValue(value interface{}) DeviceDistributionCounter_FieldPathValue {
   256  	switch fp.selector {
   257  	case DeviceDistributionCounter_FieldPathSelectorName:
   258  		return &DeviceDistributionCounter_FieldTerminalPathValue{DeviceDistributionCounter_FieldTerminalPath: *fp, value: value.(*Name)}
   259  	case DeviceDistributionCounter_FieldPathSelectorMetadata:
   260  		return &DeviceDistributionCounter_FieldTerminalPathValue{DeviceDistributionCounter_FieldTerminalPath: *fp, value: value.(*meta.Meta)}
   261  	case DeviceDistributionCounter_FieldPathSelectorTotalCount:
   262  		return &DeviceDistributionCounter_FieldTerminalPathValue{DeviceDistributionCounter_FieldTerminalPath: *fp, value: value.(int64)}
   263  	case DeviceDistributionCounter_FieldPathSelectorOnlineCount:
   264  		return &DeviceDistributionCounter_FieldTerminalPathValue{DeviceDistributionCounter_FieldTerminalPath: *fp, value: value.(int64)}
   265  	default:
   266  		panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", fp.selector))
   267  	}
   268  }
   269  
   270  func (fp *DeviceDistributionCounter_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue {
   271  	return fp.WithIValue(value)
   272  }
   273  
   274  func (fp *DeviceDistributionCounter_FieldTerminalPath) WithIArrayOfValues(values interface{}) DeviceDistributionCounter_FieldPathArrayOfValues {
   275  	fpaov := &DeviceDistributionCounter_FieldTerminalPathArrayOfValues{DeviceDistributionCounter_FieldTerminalPath: *fp}
   276  	switch fp.selector {
   277  	case DeviceDistributionCounter_FieldPathSelectorName:
   278  		return &DeviceDistributionCounter_FieldTerminalPathArrayOfValues{DeviceDistributionCounter_FieldTerminalPath: *fp, values: values.([]*Name)}
   279  	case DeviceDistributionCounter_FieldPathSelectorMetadata:
   280  		return &DeviceDistributionCounter_FieldTerminalPathArrayOfValues{DeviceDistributionCounter_FieldTerminalPath: *fp, values: values.([]*meta.Meta)}
   281  	case DeviceDistributionCounter_FieldPathSelectorTotalCount:
   282  		return &DeviceDistributionCounter_FieldTerminalPathArrayOfValues{DeviceDistributionCounter_FieldTerminalPath: *fp, values: values.([]int64)}
   283  	case DeviceDistributionCounter_FieldPathSelectorOnlineCount:
   284  		return &DeviceDistributionCounter_FieldTerminalPathArrayOfValues{DeviceDistributionCounter_FieldTerminalPath: *fp, values: values.([]int64)}
   285  	default:
   286  		panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", fp.selector))
   287  	}
   288  	return fpaov
   289  }
   290  
   291  func (fp *DeviceDistributionCounter_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues {
   292  	return fp.WithIArrayOfValues(values)
   293  }
   294  
   295  func (fp *DeviceDistributionCounter_FieldTerminalPath) WithIArrayItemValue(value interface{}) DeviceDistributionCounter_FieldPathArrayItemValue {
   296  	switch fp.selector {
   297  	default:
   298  		panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", fp.selector))
   299  	}
   300  }
   301  
   302  func (fp *DeviceDistributionCounter_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue {
   303  	return fp.WithIArrayItemValue(value)
   304  }
   305  
   306  type DeviceDistributionCounter_FieldSubPath struct {
   307  	selector DeviceDistributionCounter_FieldPathSelector
   308  	subPath  gotenobject.FieldPath
   309  }
   310  
   311  var _ DeviceDistributionCounter_FieldPath = (*DeviceDistributionCounter_FieldSubPath)(nil)
   312  
   313  func (fps *DeviceDistributionCounter_FieldSubPath) Selector() DeviceDistributionCounter_FieldPathSelector {
   314  	return fps.selector
   315  }
   316  func (fps *DeviceDistributionCounter_FieldSubPath) AsMetadataSubPath() (meta.Meta_FieldPath, bool) {
   317  	res, ok := fps.subPath.(meta.Meta_FieldPath)
   318  	return res, ok
   319  }
   320  
   321  // String returns path representation in proto convention
   322  func (fps *DeviceDistributionCounter_FieldSubPath) String() string {
   323  	return fps.selector.String() + "." + fps.subPath.String()
   324  }
   325  
   326  // JSONString returns path representation is JSON convention
   327  func (fps *DeviceDistributionCounter_FieldSubPath) JSONString() string {
   328  	return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString()
   329  }
   330  
   331  // Get returns all values pointed by selected field from source DeviceDistributionCounter
   332  func (fps *DeviceDistributionCounter_FieldSubPath) Get(source *DeviceDistributionCounter) (values []interface{}) {
   333  	switch fps.selector {
   334  	case DeviceDistributionCounter_FieldPathSelectorMetadata:
   335  		values = append(values, fps.subPath.GetRaw(source.GetMetadata())...)
   336  	default:
   337  		panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", fps.selector))
   338  	}
   339  	return
   340  }
   341  
   342  func (fps *DeviceDistributionCounter_FieldSubPath) GetRaw(source proto.Message) []interface{} {
   343  	return fps.Get(source.(*DeviceDistributionCounter))
   344  }
   345  
   346  // GetSingle returns value of selected field from source DeviceDistributionCounter
   347  func (fps *DeviceDistributionCounter_FieldSubPath) GetSingle(source *DeviceDistributionCounter) (interface{}, bool) {
   348  	switch fps.selector {
   349  	case DeviceDistributionCounter_FieldPathSelectorMetadata:
   350  		if source.GetMetadata() == nil {
   351  			return nil, false
   352  		}
   353  		return fps.subPath.GetSingleRaw(source.GetMetadata())
   354  	default:
   355  		panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", fps.selector))
   356  	}
   357  }
   358  
   359  func (fps *DeviceDistributionCounter_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) {
   360  	return fps.GetSingle(source.(*DeviceDistributionCounter))
   361  }
   362  
   363  // GetDefault returns a default value of the field type
   364  func (fps *DeviceDistributionCounter_FieldSubPath) GetDefault() interface{} {
   365  	return fps.subPath.GetDefault()
   366  }
   367  
   368  func (fps *DeviceDistributionCounter_FieldSubPath) ClearValue(item *DeviceDistributionCounter) {
   369  	if item != nil {
   370  		switch fps.selector {
   371  		case DeviceDistributionCounter_FieldPathSelectorMetadata:
   372  			fps.subPath.ClearValueRaw(item.Metadata)
   373  		default:
   374  			panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", fps.selector))
   375  		}
   376  	}
   377  }
   378  
   379  func (fps *DeviceDistributionCounter_FieldSubPath) ClearValueRaw(item proto.Message) {
   380  	fps.ClearValue(item.(*DeviceDistributionCounter))
   381  }
   382  
   383  // IsLeaf - whether field path is holds simple value
   384  func (fps *DeviceDistributionCounter_FieldSubPath) IsLeaf() bool {
   385  	return fps.subPath.IsLeaf()
   386  }
   387  
   388  func (fps *DeviceDistributionCounter_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath {
   389  	iPaths := []gotenobject.FieldPath{&DeviceDistributionCounter_FieldTerminalPath{selector: fps.selector}}
   390  	iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...)
   391  	return iPaths
   392  }
   393  
   394  func (fps *DeviceDistributionCounter_FieldSubPath) WithIValue(value interface{}) DeviceDistributionCounter_FieldPathValue {
   395  	return &DeviceDistributionCounter_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)}
   396  }
   397  
   398  func (fps *DeviceDistributionCounter_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue {
   399  	return fps.WithIValue(value)
   400  }
   401  
   402  func (fps *DeviceDistributionCounter_FieldSubPath) WithIArrayOfValues(values interface{}) DeviceDistributionCounter_FieldPathArrayOfValues {
   403  	return &DeviceDistributionCounter_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)}
   404  }
   405  
   406  func (fps *DeviceDistributionCounter_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues {
   407  	return fps.WithIArrayOfValues(values)
   408  }
   409  
   410  func (fps *DeviceDistributionCounter_FieldSubPath) WithIArrayItemValue(value interface{}) DeviceDistributionCounter_FieldPathArrayItemValue {
   411  	return &DeviceDistributionCounter_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)}
   412  }
   413  
   414  func (fps *DeviceDistributionCounter_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue {
   415  	return fps.WithIArrayItemValue(value)
   416  }
   417  
   418  // DeviceDistributionCounter_FieldPathValue allows storing values for DeviceDistributionCounter fields according to their type
   419  type DeviceDistributionCounter_FieldPathValue interface {
   420  	DeviceDistributionCounter_FieldPath
   421  	gotenobject.FieldPathValue
   422  	SetTo(target **DeviceDistributionCounter)
   423  	CompareWith(*DeviceDistributionCounter) (cmp int, comparable bool)
   424  }
   425  
   426  func ParseDeviceDistributionCounter_FieldPathValue(pathStr, valueStr string) (DeviceDistributionCounter_FieldPathValue, error) {
   427  	fp, err := ParseDeviceDistributionCounter_FieldPath(pathStr)
   428  	if err != nil {
   429  		return nil, err
   430  	}
   431  	fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr)
   432  	if err != nil {
   433  		return nil, status.Errorf(codes.InvalidArgument, "error parsing DeviceDistributionCounter field path value from %s: %v", valueStr, err)
   434  	}
   435  	return fpv.(DeviceDistributionCounter_FieldPathValue), nil
   436  }
   437  
   438  func MustParseDeviceDistributionCounter_FieldPathValue(pathStr, valueStr string) DeviceDistributionCounter_FieldPathValue {
   439  	fpv, err := ParseDeviceDistributionCounter_FieldPathValue(pathStr, valueStr)
   440  	if err != nil {
   441  		panic(err)
   442  	}
   443  	return fpv
   444  }
   445  
   446  type DeviceDistributionCounter_FieldTerminalPathValue struct {
   447  	DeviceDistributionCounter_FieldTerminalPath
   448  	value interface{}
   449  }
   450  
   451  var _ DeviceDistributionCounter_FieldPathValue = (*DeviceDistributionCounter_FieldTerminalPathValue)(nil)
   452  
   453  // GetRawValue returns raw value stored under selected path for 'DeviceDistributionCounter' as interface{}
   454  func (fpv *DeviceDistributionCounter_FieldTerminalPathValue) GetRawValue() interface{} {
   455  	return fpv.value
   456  }
   457  func (fpv *DeviceDistributionCounter_FieldTerminalPathValue) AsNameValue() (*Name, bool) {
   458  	res, ok := fpv.value.(*Name)
   459  	return res, ok
   460  }
   461  func (fpv *DeviceDistributionCounter_FieldTerminalPathValue) AsMetadataValue() (*meta.Meta, bool) {
   462  	res, ok := fpv.value.(*meta.Meta)
   463  	return res, ok
   464  }
   465  func (fpv *DeviceDistributionCounter_FieldTerminalPathValue) AsTotalCountValue() (int64, bool) {
   466  	res, ok := fpv.value.(int64)
   467  	return res, ok
   468  }
   469  func (fpv *DeviceDistributionCounter_FieldTerminalPathValue) AsOnlineCountValue() (int64, bool) {
   470  	res, ok := fpv.value.(int64)
   471  	return res, ok
   472  }
   473  
   474  // SetTo stores value for selected field for object DeviceDistributionCounter
   475  func (fpv *DeviceDistributionCounter_FieldTerminalPathValue) SetTo(target **DeviceDistributionCounter) {
   476  	if *target == nil {
   477  		*target = new(DeviceDistributionCounter)
   478  	}
   479  	switch fpv.selector {
   480  	case DeviceDistributionCounter_FieldPathSelectorName:
   481  		(*target).Name = fpv.value.(*Name)
   482  	case DeviceDistributionCounter_FieldPathSelectorMetadata:
   483  		(*target).Metadata = fpv.value.(*meta.Meta)
   484  	case DeviceDistributionCounter_FieldPathSelectorTotalCount:
   485  		(*target).TotalCount = fpv.value.(int64)
   486  	case DeviceDistributionCounter_FieldPathSelectorOnlineCount:
   487  		(*target).OnlineCount = fpv.value.(int64)
   488  	default:
   489  		panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", fpv.selector))
   490  	}
   491  }
   492  
   493  func (fpv *DeviceDistributionCounter_FieldTerminalPathValue) SetToRaw(target proto.Message) {
   494  	typedObject := target.(*DeviceDistributionCounter)
   495  	fpv.SetTo(&typedObject)
   496  }
   497  
   498  // CompareWith compares value in the 'DeviceDistributionCounter_FieldTerminalPathValue' with the value under path in 'DeviceDistributionCounter'.
   499  func (fpv *DeviceDistributionCounter_FieldTerminalPathValue) CompareWith(source *DeviceDistributionCounter) (int, bool) {
   500  	switch fpv.selector {
   501  	case DeviceDistributionCounter_FieldPathSelectorName:
   502  		leftValue := fpv.value.(*Name)
   503  		rightValue := source.GetName()
   504  		if leftValue == nil {
   505  			if rightValue != nil {
   506  				return -1, true
   507  			}
   508  			return 0, true
   509  		}
   510  		if rightValue == nil {
   511  			return 1, true
   512  		}
   513  		if leftValue.String() == rightValue.String() {
   514  			return 0, true
   515  		} else if leftValue.String() < rightValue.String() {
   516  			return -1, true
   517  		} else {
   518  			return 1, true
   519  		}
   520  	case DeviceDistributionCounter_FieldPathSelectorMetadata:
   521  		return 0, false
   522  	case DeviceDistributionCounter_FieldPathSelectorTotalCount:
   523  		leftValue := fpv.value.(int64)
   524  		rightValue := source.GetTotalCount()
   525  		if (leftValue) == (rightValue) {
   526  			return 0, true
   527  		} else if (leftValue) < (rightValue) {
   528  			return -1, true
   529  		} else {
   530  			return 1, true
   531  		}
   532  	case DeviceDistributionCounter_FieldPathSelectorOnlineCount:
   533  		leftValue := fpv.value.(int64)
   534  		rightValue := source.GetOnlineCount()
   535  		if (leftValue) == (rightValue) {
   536  			return 0, true
   537  		} else if (leftValue) < (rightValue) {
   538  			return -1, true
   539  		} else {
   540  			return 1, true
   541  		}
   542  	default:
   543  		panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", fpv.selector))
   544  	}
   545  }
   546  
   547  func (fpv *DeviceDistributionCounter_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) {
   548  	return fpv.CompareWith(source.(*DeviceDistributionCounter))
   549  }
   550  
   551  type DeviceDistributionCounter_FieldSubPathValue struct {
   552  	DeviceDistributionCounter_FieldPath
   553  	subPathValue gotenobject.FieldPathValue
   554  }
   555  
   556  var _ DeviceDistributionCounter_FieldPathValue = (*DeviceDistributionCounter_FieldSubPathValue)(nil)
   557  
   558  func (fpvs *DeviceDistributionCounter_FieldSubPathValue) AsMetadataPathValue() (meta.Meta_FieldPathValue, bool) {
   559  	res, ok := fpvs.subPathValue.(meta.Meta_FieldPathValue)
   560  	return res, ok
   561  }
   562  
   563  func (fpvs *DeviceDistributionCounter_FieldSubPathValue) SetTo(target **DeviceDistributionCounter) {
   564  	if *target == nil {
   565  		*target = new(DeviceDistributionCounter)
   566  	}
   567  	switch fpvs.Selector() {
   568  	case DeviceDistributionCounter_FieldPathSelectorMetadata:
   569  		fpvs.subPathValue.(meta.Meta_FieldPathValue).SetTo(&(*target).Metadata)
   570  	default:
   571  		panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", fpvs.Selector()))
   572  	}
   573  }
   574  
   575  func (fpvs *DeviceDistributionCounter_FieldSubPathValue) SetToRaw(target proto.Message) {
   576  	typedObject := target.(*DeviceDistributionCounter)
   577  	fpvs.SetTo(&typedObject)
   578  }
   579  
   580  func (fpvs *DeviceDistributionCounter_FieldSubPathValue) GetRawValue() interface{} {
   581  	return fpvs.subPathValue.GetRawValue()
   582  }
   583  
   584  func (fpvs *DeviceDistributionCounter_FieldSubPathValue) CompareWith(source *DeviceDistributionCounter) (int, bool) {
   585  	switch fpvs.Selector() {
   586  	case DeviceDistributionCounter_FieldPathSelectorMetadata:
   587  		return fpvs.subPathValue.(meta.Meta_FieldPathValue).CompareWith(source.GetMetadata())
   588  	default:
   589  		panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", fpvs.Selector()))
   590  	}
   591  }
   592  
   593  func (fpvs *DeviceDistributionCounter_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) {
   594  	return fpvs.CompareWith(source.(*DeviceDistributionCounter))
   595  }
   596  
   597  // DeviceDistributionCounter_FieldPathArrayItemValue allows storing single item in Path-specific values for DeviceDistributionCounter according to their type
   598  // Present only for array (repeated) types.
   599  type DeviceDistributionCounter_FieldPathArrayItemValue interface {
   600  	gotenobject.FieldPathArrayItemValue
   601  	DeviceDistributionCounter_FieldPath
   602  	ContainsValue(*DeviceDistributionCounter) bool
   603  }
   604  
   605  // ParseDeviceDistributionCounter_FieldPathArrayItemValue parses string and JSON-encoded value to its Value
   606  func ParseDeviceDistributionCounter_FieldPathArrayItemValue(pathStr, valueStr string) (DeviceDistributionCounter_FieldPathArrayItemValue, error) {
   607  	fp, err := ParseDeviceDistributionCounter_FieldPath(pathStr)
   608  	if err != nil {
   609  		return nil, err
   610  	}
   611  	fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr)
   612  	if err != nil {
   613  		return nil, status.Errorf(codes.InvalidArgument, "error parsing DeviceDistributionCounter field path array item value from %s: %v", valueStr, err)
   614  	}
   615  	return fpaiv.(DeviceDistributionCounter_FieldPathArrayItemValue), nil
   616  }
   617  
   618  func MustParseDeviceDistributionCounter_FieldPathArrayItemValue(pathStr, valueStr string) DeviceDistributionCounter_FieldPathArrayItemValue {
   619  	fpaiv, err := ParseDeviceDistributionCounter_FieldPathArrayItemValue(pathStr, valueStr)
   620  	if err != nil {
   621  		panic(err)
   622  	}
   623  	return fpaiv
   624  }
   625  
   626  type DeviceDistributionCounter_FieldTerminalPathArrayItemValue struct {
   627  	DeviceDistributionCounter_FieldTerminalPath
   628  	value interface{}
   629  }
   630  
   631  var _ DeviceDistributionCounter_FieldPathArrayItemValue = (*DeviceDistributionCounter_FieldTerminalPathArrayItemValue)(nil)
   632  
   633  // GetRawValue returns stored element value for array in object DeviceDistributionCounter as interface{}
   634  func (fpaiv *DeviceDistributionCounter_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} {
   635  	return fpaiv.value
   636  }
   637  
   638  func (fpaiv *DeviceDistributionCounter_FieldTerminalPathArrayItemValue) GetSingle(source *DeviceDistributionCounter) (interface{}, bool) {
   639  	return nil, false
   640  }
   641  
   642  func (fpaiv *DeviceDistributionCounter_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) {
   643  	return fpaiv.GetSingle(source.(*DeviceDistributionCounter))
   644  }
   645  
   646  // Contains returns a boolean indicating if value that is being held is present in given 'DeviceDistributionCounter'
   647  func (fpaiv *DeviceDistributionCounter_FieldTerminalPathArrayItemValue) ContainsValue(source *DeviceDistributionCounter) bool {
   648  	slice := fpaiv.DeviceDistributionCounter_FieldTerminalPath.Get(source)
   649  	for _, v := range slice {
   650  		if asProtoMsg, ok := fpaiv.value.(proto.Message); ok {
   651  			if proto.Equal(asProtoMsg, v.(proto.Message)) {
   652  				return true
   653  			}
   654  		} else if reflect.DeepEqual(v, fpaiv.value) {
   655  			return true
   656  		}
   657  	}
   658  	return false
   659  }
   660  
   661  type DeviceDistributionCounter_FieldSubPathArrayItemValue struct {
   662  	DeviceDistributionCounter_FieldPath
   663  	subPathItemValue gotenobject.FieldPathArrayItemValue
   664  }
   665  
   666  // GetRawValue returns stored array item value
   667  func (fpaivs *DeviceDistributionCounter_FieldSubPathArrayItemValue) GetRawItemValue() interface{} {
   668  	return fpaivs.subPathItemValue.GetRawItemValue()
   669  }
   670  func (fpaivs *DeviceDistributionCounter_FieldSubPathArrayItemValue) AsMetadataPathItemValue() (meta.Meta_FieldPathArrayItemValue, bool) {
   671  	res, ok := fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue)
   672  	return res, ok
   673  }
   674  
   675  // Contains returns a boolean indicating if value that is being held is present in given 'DeviceDistributionCounter'
   676  func (fpaivs *DeviceDistributionCounter_FieldSubPathArrayItemValue) ContainsValue(source *DeviceDistributionCounter) bool {
   677  	switch fpaivs.Selector() {
   678  	case DeviceDistributionCounter_FieldPathSelectorMetadata:
   679  		return fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue).ContainsValue(source.GetMetadata())
   680  	default:
   681  		panic(fmt.Sprintf("Invalid selector for DeviceDistributionCounter: %d", fpaivs.Selector()))
   682  	}
   683  }
   684  
   685  // DeviceDistributionCounter_FieldPathArrayOfValues allows storing slice of values for DeviceDistributionCounter fields according to their type
   686  type DeviceDistributionCounter_FieldPathArrayOfValues interface {
   687  	gotenobject.FieldPathArrayOfValues
   688  	DeviceDistributionCounter_FieldPath
   689  }
   690  
   691  func ParseDeviceDistributionCounter_FieldPathArrayOfValues(pathStr, valuesStr string) (DeviceDistributionCounter_FieldPathArrayOfValues, error) {
   692  	fp, err := ParseDeviceDistributionCounter_FieldPath(pathStr)
   693  	if err != nil {
   694  		return nil, err
   695  	}
   696  	fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr)
   697  	if err != nil {
   698  		return nil, status.Errorf(codes.InvalidArgument, "error parsing DeviceDistributionCounter field path array of values from %s: %v", valuesStr, err)
   699  	}
   700  	return fpaov.(DeviceDistributionCounter_FieldPathArrayOfValues), nil
   701  }
   702  
   703  func MustParseDeviceDistributionCounter_FieldPathArrayOfValues(pathStr, valuesStr string) DeviceDistributionCounter_FieldPathArrayOfValues {
   704  	fpaov, err := ParseDeviceDistributionCounter_FieldPathArrayOfValues(pathStr, valuesStr)
   705  	if err != nil {
   706  		panic(err)
   707  	}
   708  	return fpaov
   709  }
   710  
   711  type DeviceDistributionCounter_FieldTerminalPathArrayOfValues struct {
   712  	DeviceDistributionCounter_FieldTerminalPath
   713  	values interface{}
   714  }
   715  
   716  var _ DeviceDistributionCounter_FieldPathArrayOfValues = (*DeviceDistributionCounter_FieldTerminalPathArrayOfValues)(nil)
   717  
   718  func (fpaov *DeviceDistributionCounter_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) {
   719  	switch fpaov.selector {
   720  	case DeviceDistributionCounter_FieldPathSelectorName:
   721  		for _, v := range fpaov.values.([]*Name) {
   722  			values = append(values, v)
   723  		}
   724  	case DeviceDistributionCounter_FieldPathSelectorMetadata:
   725  		for _, v := range fpaov.values.([]*meta.Meta) {
   726  			values = append(values, v)
   727  		}
   728  	case DeviceDistributionCounter_FieldPathSelectorTotalCount:
   729  		for _, v := range fpaov.values.([]int64) {
   730  			values = append(values, v)
   731  		}
   732  	case DeviceDistributionCounter_FieldPathSelectorOnlineCount:
   733  		for _, v := range fpaov.values.([]int64) {
   734  			values = append(values, v)
   735  		}
   736  	}
   737  	return
   738  }
   739  func (fpaov *DeviceDistributionCounter_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]*Name, bool) {
   740  	res, ok := fpaov.values.([]*Name)
   741  	return res, ok
   742  }
   743  func (fpaov *DeviceDistributionCounter_FieldTerminalPathArrayOfValues) AsMetadataArrayOfValues() ([]*meta.Meta, bool) {
   744  	res, ok := fpaov.values.([]*meta.Meta)
   745  	return res, ok
   746  }
   747  func (fpaov *DeviceDistributionCounter_FieldTerminalPathArrayOfValues) AsTotalCountArrayOfValues() ([]int64, bool) {
   748  	res, ok := fpaov.values.([]int64)
   749  	return res, ok
   750  }
   751  func (fpaov *DeviceDistributionCounter_FieldTerminalPathArrayOfValues) AsOnlineCountArrayOfValues() ([]int64, bool) {
   752  	res, ok := fpaov.values.([]int64)
   753  	return res, ok
   754  }
   755  
   756  type DeviceDistributionCounter_FieldSubPathArrayOfValues struct {
   757  	DeviceDistributionCounter_FieldPath
   758  	subPathArrayOfValues gotenobject.FieldPathArrayOfValues
   759  }
   760  
   761  var _ DeviceDistributionCounter_FieldPathArrayOfValues = (*DeviceDistributionCounter_FieldSubPathArrayOfValues)(nil)
   762  
   763  func (fpsaov *DeviceDistributionCounter_FieldSubPathArrayOfValues) GetRawValues() []interface{} {
   764  	return fpsaov.subPathArrayOfValues.GetRawValues()
   765  }
   766  func (fpsaov *DeviceDistributionCounter_FieldSubPathArrayOfValues) AsMetadataPathArrayOfValues() (meta.Meta_FieldPathArrayOfValues, bool) {
   767  	res, ok := fpsaov.subPathArrayOfValues.(meta.Meta_FieldPathArrayOfValues)
   768  	return res, ok
   769  }