// 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 sfgate_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" ) // Tenant Taxnexus Account Tenant // // swagger:model Tenant type Tenant struct { // The Account that owns this Tenant Accountid string `json:"accountid,omitempty"` // Is this Tenant currently active? Active bool `json:"active,omitempty"` // Created By Createdbyid string `json:"createdbyid,omitempty"` // Created Date Createddate string `json:"createddate,omitempty"` // databases Databases []*Database `json:"databases"` // Record Id ID string `json:"id,omitempty"` // Last Modified By Lastmodifiedbyid string `json:"lastmodifiedbyid,omitempty"` // Last Modifed Date Lastmodifieddate string `json:"lastmodifieddate,omitempty"` // roles Roles []*Role `json:"roles"` // The current status of this Tenant Status string `json:"status,omitempty"` // Name of the Tenant Resource Tenantname string `json:"tenantname,omitempty"` // tenantusers Tenantusers []*TenantUser `json:"tenantusers"` // Type of tenant Type string `json:"type,omitempty"` // The version number of the Tenant Onboarding system used to create this tenant Version string `json:"version,omitempty"` } // Validate validates this tenant func (m *Tenant) Validate(formats strfmt.Registry) error { var res []error if err := m.validateDatabases(formats); err != nil { res = append(res, err) } if err := m.validateRoles(formats); err != nil { res = append(res, err) } if err := m.validateTenantusers(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Tenant) validateDatabases(formats strfmt.Registry) error { if swag.IsZero(m.Databases) { // not required return nil } for i := 0; i < len(m.Databases); i++ { if swag.IsZero(m.Databases[i]) { // not required continue } if m.Databases[i] != nil { if err := m.Databases[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("databases" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("databases" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *Tenant) validateRoles(formats strfmt.Registry) error { if swag.IsZero(m.Roles) { // not required return nil } for i := 0; i < len(m.Roles); i++ { if swag.IsZero(m.Roles[i]) { // not required continue } if m.Roles[i] != nil { if err := m.Roles[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("roles" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("roles" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *Tenant) 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)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("tenantusers" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this tenant based on the context it is used func (m *Tenant) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateDatabases(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateRoles(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateTenantusers(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Tenant) contextValidateDatabases(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Databases); i++ { if m.Databases[i] != nil { if err := m.Databases[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("databases" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("databases" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *Tenant) contextValidateRoles(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Roles); i++ { if m.Roles[i] != nil { if err := m.Roles[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("roles" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("roles" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *Tenant) 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)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("tenantusers" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *Tenant) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *Tenant) UnmarshalBinary(b []byte) error { var res Tenant if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }