// 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 (
	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
)

// Site site
//
// swagger:model site
type Site struct {

	// account id
	AccountID string `json:"account_id,omitempty"`

	// account name
	AccountName string `json:"account_name,omitempty"`

	// account slug
	AccountSlug string `json:"account_slug,omitempty"`

	// admin url
	AdminURL string `json:"admin_url,omitempty"`

	// branch deploy custom domain
	BranchDeployCustomDomain string `json:"branch_deploy_custom_domain,omitempty"`

	// build image
	BuildImage string `json:"build_image,omitempty"`

	// build settings
	BuildSettings *RepoInfo `json:"build_settings,omitempty"`

	// capabilities
	Capabilities map[string]interface{} `json:"capabilities,omitempty"`

	// created at
	CreatedAt string `json:"created_at,omitempty"`

	// custom domain
	CustomDomain string `json:"custom_domain,omitempty"`

	// default hooks data
	DefaultHooksData *SiteDefaultHooksData `json:"default_hooks_data,omitempty"`

	// deploy hook
	DeployHook string `json:"deploy_hook,omitempty"`

	// deploy preview custom domain
	DeployPreviewCustomDomain string `json:"deploy_preview_custom_domain,omitempty"`

	// deploy url
	DeployURL string `json:"deploy_url,omitempty"`

	// domain aliases
	DomainAliases []string `json:"domain_aliases"`

	// force ssl
	ForceSsl bool `json:"force_ssl,omitempty"`

	// functions region
	FunctionsRegion string `json:"functions_region,omitempty"`

	// git provider
	GitProvider string `json:"git_provider,omitempty"`

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

	// id domain
	IDDomain string `json:"id_domain,omitempty"`

	// managed dns
	ManagedDNS bool `json:"managed_dns,omitempty"`

	// name
	Name string `json:"name,omitempty"`

	// notification email
	NotificationEmail string `json:"notification_email,omitempty"`

	// password
	Password string `json:"password,omitempty"`

	// plan
	Plan string `json:"plan,omitempty"`

	// prerender
	Prerender string `json:"prerender,omitempty"`

	// processing settings
	ProcessingSettings *SiteProcessingSettings `json:"processing_settings,omitempty"`

	// published deploy
	PublishedDeploy *Deploy `json:"published_deploy,omitempty"`

	// screenshot url
	ScreenshotURL string `json:"screenshot_url,omitempty"`

	// session id
	SessionID string `json:"session_id,omitempty"`

	// ssl
	Ssl bool `json:"ssl,omitempty"`

	// ssl url
	SslURL string `json:"ssl_url,omitempty"`

	// state
	State string `json:"state,omitempty"`

	// updated at
	UpdatedAt string `json:"updated_at,omitempty"`

	// url
	URL string `json:"url,omitempty"`

	// user id
	UserID string `json:"user_id,omitempty"`
}

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

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

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

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

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

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

func (m *Site) validateBuildSettings(formats strfmt.Registry) error {

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

	if m.BuildSettings != nil {
		if err := m.BuildSettings.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("build_settings")
			}
			return err
		}
	}

	return nil
}

func (m *Site) validateDefaultHooksData(formats strfmt.Registry) error {

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

	if m.DefaultHooksData != nil {
		if err := m.DefaultHooksData.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("default_hooks_data")
			}
			return err
		}
	}

	return nil
}

func (m *Site) validateProcessingSettings(formats strfmt.Registry) error {

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

	if m.ProcessingSettings != nil {
		if err := m.ProcessingSettings.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("processing_settings")
			}
			return err
		}
	}

	return nil
}

func (m *Site) validatePublishedDeploy(formats strfmt.Registry) error {

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

	if m.PublishedDeploy != nil {
		if err := m.PublishedDeploy.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("published_deploy")
			}
			return err
		}
	}

	return nil
}

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

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