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

// PointSource point source
//
// swagger:model PointSource
type PointSource struct {

	// The display name of the device the map point represents (if type=device). This field supports Glob (*)
	DeviceDisplayName string `json:"deviceDisplayName,omitempty"`

	// The full path of the device group associated with the map point. This may be the group the map point represents, or the group of the device that the map point represents
	// Required: true
	DeviceGroupFullPath *string `json:"deviceGroupFullPath"`

	// Whether or not the specified group or device has a location property defined
	// Read Only: true
	HasLocation *bool `json:"hasLocation,omitempty"`

	// Whether or not the mapPoint represents a device or a group
	Type string `json:"type,omitempty"`
}

// Validate validates this point source
func (m *PointSource) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *PointSource) validateDeviceGroupFullPath(formats strfmt.Registry) error {

	if err := validate.Required("deviceGroupFullPath", "body", m.DeviceGroupFullPath); err != nil {
		return err
	}

	return nil
}

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

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

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

func (m *PointSource) contextValidateHasLocation(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

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

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