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

package applicationuser

import (
	"context"

	"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
	"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
	"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_application_user" "example" {
	  organization_id = "org1a23f456789"
	  user_id         = "foo"

	  // COMPUTED FIELDS
	  email          = "test@example.com"
	  is_super_admin = false
	  name           = "test"
	}
*/
func newDatasourceSchema(ctx context.Context) schema.Schema {
	return schema.Schema{
		Attributes: map[string]schema.Attribute{
			"email": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "User Email.",
			},
			"id": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "Resource ID, a composite of `organization_id` and `user_id` IDs.",
			},
			"is_super_admin": schema.BoolAttribute{
				Computed:            true,
				DeprecationMessage:  "This field is no longer accepted by the API. For administrative tasks, assign application users the organization admin role instead using the aiven_organization_permission resource.",
				MarkdownDescription: "Alters super admin state of the organization application user. The default value is `false`.",
			},
			"name": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "Name.",
			},
			"organization_id": schema.StringAttribute{
				MarkdownDescription: "ID of an organization.",
				Required:            true,
			},
			"user_id": schema.StringAttribute{
				MarkdownDescription: "User ID.",
				Required:            true,
			},
		},
		Blocks:              map[string]schema.Block{"timeouts": timeouts.Block(ctx)},
		MarkdownDescription: "Gets information about an application user.",
	}
}
