// 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 (
	"encoding/json"

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

// DevServerHook dev server hook
//
// swagger:model devServerHook
type DevServerHook struct {

	// branch
	Branch string `json:"branch,omitempty"`

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

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

	// site id
	SiteID string `json:"site_id,omitempty"`

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

	// type
	// Enum: [new_dev_server content_refresh]
	Type string `json:"type,omitempty"`

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

// Validate validates this dev server hook
func (m *DevServerHook) Validate(formats strfmt.Registry) error {
	var res []error

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

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

var devServerHookTypeTypePropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["new_dev_server","content_refresh"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		devServerHookTypeTypePropEnum = append(devServerHookTypeTypePropEnum, v)
	}
}

const (

	// DevServerHookTypeNewDevServer captures enum value "new_dev_server"
	DevServerHookTypeNewDevServer string = "new_dev_server"

	// DevServerHookTypeContentRefresh captures enum value "content_refresh"
	DevServerHookTypeContentRefresh string = "content_refresh"
)

// prop value enum
func (m *DevServerHook) validateTypeEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, devServerHookTypeTypePropEnum, true); err != nil {
		return err
	}
	return nil
}

func (m *DevServerHook) validateType(formats strfmt.Registry) error {

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

	// value enum
	if err := m.validateTypeEnum("type", "body", m.Type); err != nil {
		return err
	}

	return nil
}

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

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