lib/api/members/members_models/track_user.go

132 lines
3.0 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package members_models
import (
"context"
"encoding/json"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag/jsonutils"
"github.com/go-openapi/swag/typeutils"
"github.com/go-openapi/validate"
)
// TrackUser A governed association between a tenant-bounded Track and an active User in the same configured tenant. TrackID and UserID are immutable; only Role may be CAS-updated.
//
// swagger:model TrackUser
type TrackUser struct {
// created by ID
CreatedByID *string `json:"CreatedByID,omitempty"`
// created date
CreatedDate *string `json:"CreatedDate,omitempty"`
// ID
ID string `json:"ID,omitempty"`
// last modified by ID
LastModifiedByID *string `json:"LastModifiedByID,omitempty"`
// last modified date
LastModifiedDate *string `json:"LastModifiedDate,omitempty"`
// role
// Enum: ["Attendee","Moderator","Presenter"]
Role string `json:"Role,omitempty"`
// track ID
TrackID string `json:"TrackID,omitempty"`
// user ID
UserID string `json:"UserID,omitempty"`
}
// Validate validates this track user
func (m *TrackUser) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateRole(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
var trackUserTypeRolePropEnum []any
func init() {
var res []string
if err := json.Unmarshal([]byte(`["Attendee","Moderator","Presenter"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
trackUserTypeRolePropEnum = append(trackUserTypeRolePropEnum, v)
}
}
const (
// TrackUserRoleAttendee captures enum value "Attendee"
TrackUserRoleAttendee string = "Attendee"
// TrackUserRoleModerator captures enum value "Moderator"
TrackUserRoleModerator string = "Moderator"
// TrackUserRolePresenter captures enum value "Presenter"
TrackUserRolePresenter string = "Presenter"
)
// prop value enum
func (m *TrackUser) validateRoleEnum(path, location string, value string) error {
if err := validate.EnumCase(path, location, value, trackUserTypeRolePropEnum, true); err != nil {
return err
}
return nil
}
func (m *TrackUser) validateRole(formats strfmt.Registry) error {
if typeutils.IsZero(m.Role) { // not required
return nil
}
// value enum
if err := m.validateRoleEnum("Role", "body", m.Role); err != nil {
return err
}
return nil
}
// ContextValidate validates this track user based on context it is used
func (m *TrackUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *TrackUser) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return jsonutils.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *TrackUser) UnmarshalBinary(b []byte) error {
var res TrackUser
if err := jsonutils.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}