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

// ReportSettings report settings
//
// swagger:model ReportSettings
type ReportSettings struct {

	// branding
	Branding *ReportBrandingOptions `json:"branding,omitempty"`

	// id
	ID int64 `json:"id,omitempty"`

	// org Id
	OrgID int64 `json:"orgId,omitempty"`

	// user Id
	UserID int64 `json:"userId,omitempty"`
}

// Validate validates this report settings
func (m *ReportSettings) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *ReportSettings) validateBranding(formats strfmt.Registry) error {
	if swag.IsZero(m.Branding) { // not required
		return nil
	}

	if m.Branding != nil {
		if err := m.Branding.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("branding")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("branding")
			}
			return err
		}
	}

	return nil
}

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

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

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

func (m *ReportSettings) contextValidateBranding(ctx context.Context, formats strfmt.Registry) error {

	if m.Branding != nil {

		if swag.IsZero(m.Branding) { // not required
			return nil
		}

		if err := m.Branding.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("branding")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("branding")
			}
			return err
		}
	}

	return nil
}

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

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