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

// All Code Copyright(c) 2018-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package sf_gate_models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"strconv"

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

// Notebook Defines a Taxnexus Notebook
//
// swagger:model Notebook
type Notebook struct {

	// Account
	Accountid string `json:"accountid,omitempty"`

	// Contact
	Contactid string `json:"contactid,omitempty"`

	// Created By
	Createdbyid string `json:"createdbyid,omitempty"`

	// Created Date
	Createddate string `json:"createddate,omitempty"`

	// Analysis Date
	Date string `json:"date,omitempty"`

	// End Date
	Dateend string `json:"dateend,omitempty"`

	// Start Date
	Datestart string `json:"datestart,omitempty"`

	// Description
	Description string `json:"description,omitempty"`

	// Record Id
	ID string `json:"id,omitempty"`

	// items
	Items []*NotebookItem `json:"items"`

	// Last Modified By
	Lastmodifiedbyid string `json:"lastmodifiedbyid,omitempty"`

	// Last Modifed Date
	Lastmodifieddate string `json:"lastmodifieddate,omitempty"`

	// Ending Period
	Periodendid string `json:"periodendid,omitempty"`

	// Starting Period
	Periodstartid string `json:"periodstartid,omitempty"`

	// Preparer
	Preparerid string `json:"preparerid,omitempty"`

	// tenant identifier
	Tenantid string `json:"tenantid,omitempty"`

	// Title
	Title string `json:"title,omitempty"`
}

// Validate validates this notebook
func (m *Notebook) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *Notebook) validateItems(formats strfmt.Registry) error {

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

	for i := 0; i < len(m.Items); i++ {
		if swag.IsZero(m.Items[i]) { // not required
			continue
		}

		if m.Items[i] != nil {
			if err := m.Items[i].Validate(formats); err != nil {
				if ve, ok := err.(*errors.Validation); ok {
					return ve.ValidateName("items" + "." + strconv.Itoa(i))
				}
				return err
			}
		}

	}

	return nil
}

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

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