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

// DashboardData dashboard data
//
// swagger:model DashboardData
type DashboardData struct {

	// id
	// Read Only: true
	ID int32 `json:"id,omitempty"`

	// name
	// Read Only: true
	Name string `json:"name,omitempty"`

	// sharable
	// Read Only: true
	Sharable *bool `json:"sharable,omitempty"`

	// user permission
	// Read Only: true
	UserPermission string `json:"userPermission,omitempty"`
}

// Validate validates this dashboard data
func (m *DashboardData) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validate this dashboard data based on the context it is used
func (m *DashboardData) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

func (m *DashboardData) contextValidateID(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "id", "body", int32(m.ID)); err != nil {
		return err
	}

	return nil
}

func (m *DashboardData) contextValidateName(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "name", "body", string(m.Name)); err != nil {
		return err
	}

	return nil
}

func (m *DashboardData) contextValidateSharable(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "sharable", "body", m.Sharable); err != nil {
		return err
	}

	return nil
}

func (m *DashboardData) contextValidateUserPermission(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "userPermission", "body", string(m.UserPermission)); err != nil {
		return err
	}

	return nil
}

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

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