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

// CreateBranchRepoOption CreateBranchRepoOption options when creating a branch in a repository
//
// swagger:model CreateBranchRepoOption
type CreateBranchRepoOption struct {

	// Name of the branch to create
	// Required: true
	BranchName *string `json:"new_branch_name"`

	// Deprecated: true
	// Name of the old branch to create from
	OldBranchName string `json:"old_branch_name,omitempty"`

	// Name of the old branch/tag/commit to create from
	OldRefName string `json:"old_ref_name,omitempty"`
}

// Validate validates this create branch repo option
func (m *CreateBranchRepoOption) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *CreateBranchRepoOption) validateBranchName(formats strfmt.Registry) error {

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

	return nil
}

// ContextValidate validates this create branch repo option based on context it is used
func (m *CreateBranchRepoOption) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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