lib/api/auth/auth_models/user.go

377 lines
8.1 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
// (c) 2012-2020 by Telnexus LLC
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed
package auth_models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// User user
//
// swagger:model User
type User struct {
// API Key
APIKey string `json:"APIKey,omitempty"`
// About Me
AboutMe string `json:"AboutMe,omitempty"`
// Account ID
AccountID string `json:"AccountID,omitempty"`
// address
Address *Address `json:"Address,omitempty"`
// Alias
Alias string `json:"Alias,omitempty"`
// Auth0 User Id
Auth0UserID string `json:"Auth0UserID,omitempty"`
// Nickname
CommunityNickname string `json:"CommunityNickname,omitempty"`
// Company Name
CompanyName string `json:"CompanyName,omitempty"`
// Contact
ContactID string `json:"ContactID,omitempty"`
// Created User ID
CreatedByID string `json:"CreatedByID,omitempty"`
// Date Created
CreatedDate string `json:"CreatedDate,omitempty"`
// Delegated Approver
DelegatedApproverID string `json:"DelegatedApproverID,omitempty"`
// Department
Department string `json:"Department,omitempty"`
// Division
Division string `json:"Division,omitempty"`
// Email address
Email string `json:"Email,omitempty"`
// Employee Number
EmployeeNumber string `json:"EmployeeNumber,omitempty"`
// Time day ends
EndOfDay string `json:"EndOfDay,omitempty"`
// Environment
Environment string `json:"Environment,omitempty"`
// Extension
Extension string `json:"Extension,omitempty"`
// Fabric API Key
FabricAPIKey string `json:"FabricAPIKey,omitempty"`
// Fax
Fax string `json:"Fax,omitempty"`
// The first name
FirstName string `json:"FirstName,omitempty"`
// Allow Forecasting
ForecastEnabled bool `json:"ForecastEnabled,omitempty"`
// Full Photo URL
FullPhotoURL string `json:"FullPhotoURL,omitempty"`
// Telnexus ID
ID string `json:"ID,omitempty"`
// Active
IsActive bool `json:"IsActive,omitempty"`
// Is the user enabled for Communities?
IsPortalEnabled bool `json:"IsPortalEnabled,omitempty"`
// Has Profile Photo
IsProphilePhotoActive bool `json:"IsProphilePhotoActive,omitempty"`
// is system controlled
IsSystemControlled bool `json:"IsSystemControlled,omitempty"`
// IP address of last login
LastIP string `json:"LastIP,omitempty"`
// Last login time
LastLogin string `json:"LastLogin,omitempty"`
// Last Modified User ID
LastModifiedByID string `json:"LastModifiedByID,omitempty"`
// Last Modified Date
LastModifiedDate string `json:"LastModifiedDate,omitempty"`
// The Last Name
LastName string `json:"LastName,omitempty"`
// Number of times user has logged in
LoginCount int64 `json:"LoginCount,omitempty"`
// Manager
ManagerID string `json:"ManagerID,omitempty"`
// Mobile
MobilePhone string `json:"MobilePhone,omitempty"`
// Name
Name string `json:"Name,omitempty"`
// Out of office message
OutOfOfficeMessage string `json:"OutOfOfficeMessage,omitempty"`
// Phone
Phone string `json:"Phone,omitempty"`
// Portal Role Level
PortalRole string `json:"PortalRole,omitempty"`
// Profile
ProfileID string `json:"ProfileID,omitempty"`
// Info Emails
ReceivesAdminEmails bool `json:"ReceivesAdminEmails,omitempty"`
// Admin Info Emails
ReceivesAdminInfoEmails bool `json:"ReceivesAdminInfoEmails,omitempty"`
// Email Sender Address
SenderEmail string `json:"SenderEmail,omitempty"`
// Email Sender Name
SenderName string `json:"SenderName,omitempty"`
// Email Signature
Signature string `json:"Signature,omitempty"`
// Small Photo URL
SmallPhotoURL string `json:"SmallPhotoURL,omitempty"`
// The time day starts
StartOfDay string `json:"StartOfDay,omitempty"`
// Telnexus Account
TelnexusAccount string `json:"TelnexusAccount,omitempty"`
// Tenant ID associated with this user
TenantID string `json:"TenantID,omitempty"`
// tenant users
TenantUsers []*TenantUser `json:"TenantUsers"`
// Time Zone
TimeZone string `json:"TimeZone,omitempty"`
// Title
Title string `json:"Title,omitempty"`
// Role
UserRoleID string `json:"UserRoleID,omitempty"`
// user roles
UserRoles []*UserRole `json:"UserRoles"`
// User Type
UserType string `json:"UserType,omitempty"`
// Username
Username string `json:"Username,omitempty"`
}
// Validate validates this user
func (m *User) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAddress(formats); err != nil {
res = append(res, err)
}
if err := m.validateTenantUsers(formats); err != nil {
res = append(res, err)
}
if err := m.validateUserRoles(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *User) validateAddress(formats strfmt.Registry) error {
if swag.IsZero(m.Address) { // not required
return nil
}
if m.Address != nil {
if err := m.Address.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Address")
}
return err
}
}
return nil
}
func (m *User) validateTenantUsers(formats strfmt.Registry) error {
if swag.IsZero(m.TenantUsers) { // not required
return nil
}
for i := 0; i < len(m.TenantUsers); i++ {
if swag.IsZero(m.TenantUsers[i]) { // not required
continue
}
if m.TenantUsers[i] != nil {
if err := m.TenantUsers[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *User) validateUserRoles(formats strfmt.Registry) error {
if swag.IsZero(m.UserRoles) { // not required
return nil
}
for i := 0; i < len(m.UserRoles); i++ {
if swag.IsZero(m.UserRoles[i]) { // not required
continue
}
if m.UserRoles[i] != nil {
if err := m.UserRoles[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("UserRoles" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this user based on the context it is used
func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateAddress(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateTenantUsers(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateUserRoles(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *User) contextValidateAddress(ctx context.Context, formats strfmt.Registry) error {
if m.Address != nil {
if err := m.Address.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Address")
}
return err
}
}
return nil
}
func (m *User) contextValidateTenantUsers(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.TenantUsers); i++ {
if m.TenantUsers[i] != nil {
if err := m.TenantUsers[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("TenantUsers" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *User) contextValidateUserRoles(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.UserRoles); i++ {
if m.UserRoles[i] != nil {
if err := m.UserRoles[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("UserRoles" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *User) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *User) UnmarshalBinary(b []byte) error {
var res User
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}