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

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

// PortalMeta portal meta
//
// swagger:model PortalMeta
type PortalMeta struct {

	// limit
	Limit int64 `json:"limit,omitempty"`

	// offset
	Offset int64 `json:"offset,omitempty"`

	// operation Id
	OperationID string `json:"operationId,omitempty"`

	// server timestamp
	// Format: date-time
	ServerTimestamp strfmt.DateTime `json:"serverTimestamp,omitempty"`
}

// Validate validates this portal meta
func (m *PortalMeta) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *PortalMeta) validateServerTimestamp(formats strfmt.Registry) error {
	if typeutils.IsZero(m.ServerTimestamp) { // not required
		return nil
	}

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

	return nil
}

// ContextValidate validates this portal meta based on context it is used
func (m *PortalMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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