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

package types

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

// NetworkCreateConfig contains the request for the remote API: POST /networks/create
// swagger:model NetworkCreateConfig
type NetworkCreateConfig struct {

	// Name is the name of the network.
	Name string `json:"Name,omitempty"`

	NetworkCreate
}

// UnmarshalJSON unmarshals this object from a JSON structure
func (m *NetworkCreateConfig) UnmarshalJSON(raw []byte) error {
	// AO0
	var dataAO0 struct {
		Name string `json:"Name,omitempty"`
	}
	if err := swag.ReadJSON(raw, &dataAO0); err != nil {
		return err
	}

	m.Name = dataAO0.Name

	// AO1
	var aO1 NetworkCreate
	if err := swag.ReadJSON(raw, &aO1); err != nil {
		return err
	}
	m.NetworkCreate = aO1

	return nil
}

// MarshalJSON marshals this object to a JSON structure
func (m NetworkCreateConfig) MarshalJSON() ([]byte, error) {
	_parts := make([][]byte, 0, 2)

	var dataAO0 struct {
		Name string `json:"Name,omitempty"`
	}

	dataAO0.Name = m.Name

	jsonDataAO0, errAO0 := swag.WriteJSON(dataAO0)
	if errAO0 != nil {
		return nil, errAO0
	}
	_parts = append(_parts, jsonDataAO0)

	aO1, err := swag.WriteJSON(m.NetworkCreate)
	if err != nil {
		return nil, err
	}
	_parts = append(_parts, aO1)

	return swag.ConcatJSON(_parts...), nil
}

// Validate validates this network create config
func (m *NetworkCreateConfig) Validate(formats strfmt.Registry) error {
	var res []error

	// validation for a type composition with NetworkCreate
	if err := m.NetworkCreate.Validate(formats); err != nil {
		res = append(res, err)
	}

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

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

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