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

// HashicorpCloudWaypointV20241122TFModuleVariable TFModuleVariable represents a Terraform module variable.
//
// swagger:model hashicorp.cloud.waypoint.v20241122.TFModuleVariable
type HashicorpCloudWaypointV20241122TFModuleVariable struct {

	// description is the description of the variable.
	Description string `json:"description,omitempty"`

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

	// options is the list of options for the variable, set in Terraform Cloud.
	// 1. If len(options) == 0, then the variable is forcibly left unset.
	// 2. If len(options) == 1, then the variable was set to be that value by the platform engineer, and cannot be set by the app developer.
	// 3. If len(options) > 1, then the variable may be set to one of the options in the list, which can be chosen by the app developer.
	Options []string `json:"options"`

	// indicates if the variable may be set by the app developer.
	UserEditable bool `json:"user_editable,omitempty"`

	// variable_type is the type of Terraform variable. See the documentation for more info:
	// https://developer.hashicorp.com/terraform/language/expressions/types
	// The API client should not set this field.
	// Read Only: true
	VariableType string `json:"variable_type,omitempty"`
}

// Validate validates this hashicorp cloud waypoint v20241122 t f module variable
func (m *HashicorpCloudWaypointV20241122TFModuleVariable) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validate this hashicorp cloud waypoint v20241122 t f module variable based on the context it is used
func (m *HashicorpCloudWaypointV20241122TFModuleVariable) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

func (m *HashicorpCloudWaypointV20241122TFModuleVariable) contextValidateVariableType(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "variable_type", "body", string(m.VariableType)); err != nil {
		return err
	}

	return nil
}

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

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