// Copyright (c) 2025 Aiven, Helsinki, Finland. https://aiven.io/
// Code generated by user config generator. DO NOT EDIT.

package address

import (
	"context"

	"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
	"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
	"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
	"github.com/hashicorp/terraform-plugin-framework/schema/validator"
	"github.com/hashicorp/terraform-plugin-framework/types"

	"github.com/aiven/terraform-provider-aiven/internal/plugin/adapter"
)

func newDatasourceModel() adapter.Model[tfModel] {
	return new(datasourceModel)
}

// datasourceModel with specific datasource timeouts
type datasourceModel struct {
	tfModel
	Timeouts timeouts.Value `tfsdk:"timeouts"`
}

func (tf *datasourceModel) SharedModel() *tfModel {
	return &tf.tfModel
}

func (tf *datasourceModel) TimeoutsObject() types.Object {
	return tf.Timeouts.Object
}

/*
newDatasourceSchema:

	data "aiven_organization_address" "example" {
	  organization_id = "org1a23f456789"
	  address_id      = "foo"

	  // COMPUTED FIELDS
	  address_lines = ["foo"]
	  city          = "foo"
	  country_code  = "foo"
	  create_time   = "foo"
	  name          = "test"
	  state         = "foo"
	  update_time   = "foo"
	  zip_code      = "foo"
	}
*/
func newDatasourceSchema(ctx context.Context) schema.Schema {
	return schema.Schema{
		Attributes: map[string]schema.Attribute{
			"address_id": schema.StringAttribute{
				MarkdownDescription: "Address ID.",
				Required:            true,
				Validators:          []validator.String{stringvalidator.LengthAtMost(36)},
			},
			"address_lines": schema.SetAttribute{
				Computed:            true,
				ElementType:         types.StringType,
				MarkdownDescription: "Address Lines.",
			},
			"city": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "City.",
			},
			"country_code": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "Country Code.",
			},
			"create_time": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "Create Time.",
			},
			"id": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "Resource ID, a composite of `organization_id` and `address_id` IDs.",
			},
			"name": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "Name of a company.",
			},
			"organization_id": schema.StringAttribute{
				MarkdownDescription: "ID of an organization.",
				Required:            true,
				Validators:          []validator.String{stringvalidator.LengthAtMost(36)},
			},
			"state": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "State.",
			},
			"update_time": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "Update Time.",
			},
			"zip_code": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "Zip Code.",
			},
		},
		Blocks:              map[string]schema.Block{"timeouts": timeouts.Block(ctx)},
		MarkdownDescription: "Gets information about an organization address. \n\n**This resource is in the beta stage and may change without notice.** Set\nthe `PROVIDER_AIVEN_ENABLE_BETA` environment variable to use the resource.",
	}
}
