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

package billinggroup

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_billing_group" "example" {
	  organization_id        = "org1a23f456789" // Force new
	  billing_address_id     = "foo"
	  billing_contact_emails = ["test@example.com"]
	  billing_emails         = ["test@example.com"]
	  billing_group_name     = "test"
	  currency               = "AUD"
	  custom_invoice_text    = "foo"
	  payment_method_id      = "foo"
	  shipping_address_id    = "foo"
	  vat_id                 = "foo"

	  // COMPUTED FIELDS
	  billing_group_id = "foo"
	}
*/
func newResourceSchema(ctx context.Context) schema.Schema {
	return schema.Schema{
		Attributes: map[string]schema.Attribute{
			"billing_address_id": schema.StringAttribute{
				MarkdownDescription: "Billing address ID. Maximum length: `36`.",
				Required:            true,
				Validators:          []validator.String{stringvalidator.LengthAtMost(36)},
			},
			"billing_contact_emails": schema.SetAttribute{
				ElementType:         types.StringType,
				MarkdownDescription: "List of billing contact emails.",
				Required:            true,
			},
			"billing_emails": schema.SetAttribute{
				ElementType:         types.StringType,
				MarkdownDescription: "List of billing contact emails.",
				Required:            true,
			},
			"billing_group_id": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "Billing group ID.",
			},
			"billing_group_name": schema.StringAttribute{
				MarkdownDescription: "Billing Group Name. Maximum length: `128`.",
				Required:            true,
				Validators:          []validator.String{stringvalidator.LengthAtMost(128)},
			},
			"currency": schema.StringAttribute{
				MarkdownDescription: "Acceptable currencies for a billing group. The possible values are `AUD`, `CAD`, `CHF`, `DKK`, `EUR`, `GBP`, `JPY`, `NOK`, `NZD`, `SEK`, `SGD` and `USD`.",
				Optional:            true,
				Validators:          []validator.String{stringvalidator.OneOf("AUD", "CAD", "CHF", "DKK", "EUR", "GBP", "JPY", "NOK", "NZD", "SEK", "SGD", "USD")},
			},
			"custom_invoice_text": schema.StringAttribute{
				MarkdownDescription: "Extra billing text. Maximum length: `256`.",
				Optional:            true,
				Validators:          []validator.String{stringvalidator.LengthAtMost(256)},
			},
			"id": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "Resource ID, a composite of `organization_id` and `billing_group_id` IDs.",
				PlanModifiers:       []planmodifier.String{stringplanmodifier.UseStateForUnknown()},
			},
			"organization_id": schema.StringAttribute{
				MarkdownDescription: "ID of an organization. Maximum length: `36`. Changing this property forces recreation of the resource.",
				PlanModifiers:       []planmodifier.String{stringplanmodifier.RequiresReplace()},
				Required:            true,
				Validators:          []validator.String{stringvalidator.LengthAtMost(36)},
			},
			"payment_method_id": schema.StringAttribute{
				MarkdownDescription: "Payment method ID.",
				Required:            true,
			},
			"shipping_address_id": schema.StringAttribute{
				MarkdownDescription: "Shipping address ID. Maximum length: `36`.",
				Required:            true,
				Validators:          []validator.String{stringvalidator.LengthAtMost(36)},
			},
			"vat_id": schema.StringAttribute{
				MarkdownDescription: "VAT ID.",
				Optional:            true,
			},
		},
		Blocks:              map[string]schema.Block{"timeouts": timeouts.BlockAll(ctx)},
		MarkdownDescription: "Creates and manages an organization billing group. \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.",
	}
}
