// *** WARNING: this file was generated by test. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package foo

import (
	"context"
	"reflect"

	"github.com/pkg/errors"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

type ModuleResource struct {
	pulumi.CustomResourceState
}

// NewModuleResource registers a new resource with the given unique name, arguments, and options.
func NewModuleResource(ctx *pulumi.Context,
	name string, args *ModuleResourceArgs, opts ...pulumi.ResourceOption) (*ModuleResource, error) {
	if args == nil {
		return nil, errors.New("missing one or more required arguments")
	}

	if args.Optional_bool == nil {
		args.Optional_bool = pulumi.BoolPtr(true)
	}
	args.Optional_const = pulumi.StringPtr("val")
	if args.Optional_enum == nil {
		args.Optional_enum = EnumThing(8)
	}
	if args.Optional_number == nil {
		args.Optional_number = pulumi.Float64Ptr(42.0)
	}
	if args.Optional_string == nil {
		args.Optional_string = pulumi.StringPtr("buzzer")
	}
	if args.Plain_optional_bool == nil {
		plain_optional_bool_ := true
		args.Plain_optional_bool = &plain_optional_bool_
	}
	plain_optional_const_ := "val"
	args.Plain_optional_const = &plain_optional_const_
	if args.Plain_optional_number == nil {
		plain_optional_number_ := 42.0
		args.Plain_optional_number = &plain_optional_number_
	}
	if args.Plain_optional_string == nil {
		plain_optional_string_ := "buzzer"
		args.Plain_optional_string = &plain_optional_string_
	}
	if args.Plain_required_bool == false {
		args.Plain_required_bool = true
	}
	args.Plain_required_const = "val"
	if args.Plain_required_number == 0.0 {
		args.Plain_required_number = 42.0
	}
	if args.Plain_required_string == "" {
		args.Plain_required_string = "buzzer"
	}
	if args.Required_bool == nil {
		args.Required_bool = pulumi.Bool(true)
	}
	if args.Required_enum == nil {
		args.Required_enum = EnumThing(4)
	}
	if args.Required_number == nil {
		args.Required_number = pulumi.Float64(42.0)
	}
	if args.Required_string == nil {
		args.Required_string = pulumi.String("buzzer")
	}
	var resource ModuleResource
	err := ctx.RegisterResource("foobar::ModuleResource", name, args, &resource, opts...)
	if err != nil {
		return nil, err
	}
	return &resource, nil
}

// GetModuleResource gets an existing ModuleResource resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetModuleResource(ctx *pulumi.Context,
	name string, id pulumi.IDInput, state *ModuleResourceState, opts ...pulumi.ResourceOption) (*ModuleResource, error) {
	var resource ModuleResource
	err := ctx.ReadResource("foobar::ModuleResource", name, id, state, &resource, opts...)
	if err != nil {
		return nil, err
	}
	return &resource, nil
}

// Input properties used for looking up and filtering ModuleResource resources.
type moduleResourceState struct {
}

type ModuleResourceState struct {
}

func (ModuleResourceState) ElementType() reflect.Type {
	return reflect.TypeOf((*moduleResourceState)(nil)).Elem()
}

type moduleResourceArgs struct {
	Optional_bool         *bool      `pulumi:"optional_bool"`
	Optional_const        *string    `pulumi:"optional_const"`
	Optional_enum         *EnumThing `pulumi:"optional_enum"`
	Optional_number       *float64   `pulumi:"optional_number"`
	Optional_string       *string    `pulumi:"optional_string"`
	Plain_optional_bool   *bool      `pulumi:"plain_optional_bool"`
	Plain_optional_const  *string    `pulumi:"plain_optional_const"`
	Plain_optional_number *float64   `pulumi:"plain_optional_number"`
	Plain_optional_string *string    `pulumi:"plain_optional_string"`
	Plain_required_bool   bool       `pulumi:"plain_required_bool"`
	Plain_required_const  string     `pulumi:"plain_required_const"`
	Plain_required_number float64    `pulumi:"plain_required_number"`
	Plain_required_string string     `pulumi:"plain_required_string"`
	Required_bool         bool       `pulumi:"required_bool"`
	Required_enum         EnumThing  `pulumi:"required_enum"`
	Required_number       float64    `pulumi:"required_number"`
	Required_string       string     `pulumi:"required_string"`
}

// The set of arguments for constructing a ModuleResource resource.
type ModuleResourceArgs struct {
	Optional_bool         pulumi.BoolPtrInput
	Optional_const        pulumi.StringPtrInput
	Optional_enum         EnumThingPtrInput
	Optional_number       pulumi.Float64PtrInput
	Optional_string       pulumi.StringPtrInput
	Plain_optional_bool   *bool
	Plain_optional_const  *string
	Plain_optional_number *float64
	Plain_optional_string *string
	Plain_required_bool   bool
	Plain_required_const  string
	Plain_required_number float64
	Plain_required_string string
	Required_bool         pulumi.BoolInput
	Required_enum         EnumThingInput
	Required_number       pulumi.Float64Input
	Required_string       pulumi.StringInput
}

func (ModuleResourceArgs) ElementType() reflect.Type {
	return reflect.TypeOf((*moduleResourceArgs)(nil)).Elem()
}

type ModuleResourceInput interface {
	pulumi.Input

	ToModuleResourceOutput() ModuleResourceOutput
	ToModuleResourceOutputWithContext(ctx context.Context) ModuleResourceOutput
}

func (*ModuleResource) ElementType() reflect.Type {
	return reflect.TypeOf((*ModuleResource)(nil))
}

func (i *ModuleResource) ToModuleResourceOutput() ModuleResourceOutput {
	return i.ToModuleResourceOutputWithContext(context.Background())
}

func (i *ModuleResource) ToModuleResourceOutputWithContext(ctx context.Context) ModuleResourceOutput {
	return pulumi.ToOutputWithContext(ctx, i).(ModuleResourceOutput)
}

type ModuleResourceOutput struct{ *pulumi.OutputState }

func (ModuleResourceOutput) ElementType() reflect.Type {
	return reflect.TypeOf((*ModuleResource)(nil))
}

func (o ModuleResourceOutput) ToModuleResourceOutput() ModuleResourceOutput {
	return o
}

func (o ModuleResourceOutput) ToModuleResourceOutputWithContext(ctx context.Context) ModuleResourceOutput {
	return o
}

func init() {
	pulumi.RegisterInputType(reflect.TypeOf((*ModuleResourceInput)(nil)).Elem(), &ModuleResource{})
	pulumi.RegisterOutputType(ModuleResourceOutput{})
}
