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

// ColumnHeader column header
//
// swagger:model ColumnHeader
type ColumnHeader struct {

	// display type
	// Read Only: true
	DisplayType string `json:"displayType,omitempty"`

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

	// need forecast
	// Read Only: true
	NeedForecast *bool `json:"needForecast,omitempty"`

	// unit label
	// Read Only: true
	UnitLabel string `json:"unitLabel,omitempty"`
}

// Validate validates this column header
func (m *ColumnHeader) Validate(formats strfmt.Registry) error {
	return nil
}

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

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

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

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

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

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

func (m *ColumnHeader) contextValidateDisplayType(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *ColumnHeader) 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 *ColumnHeader) contextValidateNeedForecast(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *ColumnHeader) contextValidateUnitLabel(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

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

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