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

package model

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"
	"encoding/json"

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

// OpenapiPrivateLinkEndpoint PrivateLinkEndpoint
//
// # PrivateLinkEndpoint
//
// swagger:model openapiPrivateLinkEndpoint
type OpenapiPrivateLinkEndpoint struct {

	// The format of the private endpoint name varies by cloud provider: `"vpce-xxxx"` for AWS and `"projects/xxx/regions/xxx/forwardingRules/xxx"` for Google Cloud.
	// Example: vpce-01234567890123456
	// Required: true
	EndpointName *string `json:"endpoint_name"`

	// The ID of the private link endpoint.
	// Example: 1
	// Required: true
	ID *string `json:"id"`

	// [Output Only] The detailed message when the `status` is "FAILED".
	// Example: The endpoint does not exist.
	Message string `json:"message,omitempty"`

	// [Output Only] The status of the private endpoint.
	// Example: ACTIVE
	// Required: true
	// Enum: [PENDING ACTIVE DELETING FAILED]
	Status *string `json:"status"`
}

// Validate validates this openapi private link endpoint
func (m *OpenapiPrivateLinkEndpoint) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

func (m *OpenapiPrivateLinkEndpoint) validateEndpointName(formats strfmt.Registry) error {

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

	return nil
}

func (m *OpenapiPrivateLinkEndpoint) validateID(formats strfmt.Registry) error {

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

	return nil
}

var openapiPrivateLinkEndpointTypeStatusPropEnum []interface{}

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

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

func (m *OpenapiPrivateLinkEndpoint) validateStatus(formats strfmt.Registry) error {

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

	// value enum
	if err := m.validateStatusEnum("status", "body", *m.Status); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this openapi private link endpoint based on context it is used
func (m *OpenapiPrivateLinkEndpoint) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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