// Code generated by go-swagger; DO NOT EDIT.

package 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"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// APITenantUserListItem api tenant user list item
//
// swagger:model apiTenantUserListItem
type APITenantUserListItem struct {

	// Created at timestamp.
	// Format: date-time
	CreatedAt strfmt.DateTime `json:"createdAt,omitempty"`

	// Email.
	Email string `json:"email,omitempty"`

	// User is admin within the context of the tenant.
	// There is no need to set the is_device_admin and is_gateway_admin flags.
	IsAdmin bool `json:"isAdmin,omitempty"`

	// User is able to modify device related resources (applications,
	// device-profiles, devices, multicast-groups).
	IsDeviceAdmin bool `json:"isDeviceAdmin,omitempty"`

	// User is able to modify gateways.
	IsGatewayAdmin bool `json:"isGatewayAdmin,omitempty"`

	// Tenant ID (UUID).
	TenantID string `json:"tenantId,omitempty"`

	// Last update timestamp.
	// Format: date-time
	UpdatedAt strfmt.DateTime `json:"updatedAt,omitempty"`

	// User ID (UUID).
	UserID string `json:"userId,omitempty"`
}

// Validate validates this api tenant user list item
func (m *APITenantUserListItem) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateCreatedAt(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateUpdatedAt(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *APITenantUserListItem) validateCreatedAt(formats strfmt.Registry) error {
	if swag.IsZero(m.CreatedAt) { // not required
		return nil
	}

	if err := validate.FormatOf("createdAt", "body", "date-time", m.CreatedAt.String(), formats); err != nil {
		return err
	}

	return nil
}

func (m *APITenantUserListItem) validateUpdatedAt(formats strfmt.Registry) error {
	if swag.IsZero(m.UpdatedAt) { // not required
		return nil
	}

	if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this api tenant user list item based on context it is used
func (m *APITenantUserListItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *APITenantUserListItem) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *APITenantUserListItem) UnmarshalBinary(b []byte) error {
	var res APITenantUserListItem
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}
