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

package organization

import (
	"context"

	"github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts"
	"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
	"github.com/hashicorp/terraform-plugin-framework/resource/schema"
	"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
	"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
	"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 newResourceModel() adapter.Model[tfModel] {
	return new(resourceModel)
}

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

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

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

/*
newResourceSchema:

	resource "aiven_organization" "example" {
	  name = "test"

	  // COMPUTED FIELDS
	  create_time = "foo"
	  id          = "foo"
	  tenant_id   = "foo"
	  update_time = "foo"
	}
*/
func newResourceSchema(ctx context.Context) schema.Schema {
	return schema.Schema{
		Attributes: map[string]schema.Attribute{
			"create_time": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "Timestamp in ISO 8601 format, always in UTC.",
			},
			"id": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "The organization ID.",
				PlanModifiers:       []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
			},
			"name": schema.StringAttribute{
				MarkdownDescription: "Name of the organization. Maximum length: `128`.",
				Required:            true,
				Validators:          []validator.String{stringvalidator.LengthAtMost(128)},
			},
			"tenant_id": schema.StringAttribute{
				Computed:            true,
				DeprecationMessage:  "This field is deprecated and will be removed in the next major release.",
				MarkdownDescription: "Tenant identifier.",
			},
			"update_time": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "Timestamp in ISO 8601 format, always in UTC.",
			},
		},
		Blocks:              map[string]schema.Block{"timeouts": timeouts.BlockAll(ctx)},
		MarkdownDescription: "Creates and manages an [organization](https://aiven.io/docs/platform/concepts/orgs-units-projects).",
	}
}
