package schemas

import (
	"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"
)

func MakeSchemaResourceDiskSnapshot() map[string]schema.Attribute {
	return map[string]schema.Attribute{
		// required attributes
		"disk_id": schema.Int64Attribute{
			Required:    true,
			Description: "The unique ID of the subscriber-owner of the disk",
		},
		"label": schema.StringAttribute{
			Required:    true,
			Description: "Name of the snapshot",
		},

		// optional attributes
		"rollback": schema.BoolAttribute{
			Optional:    true,
			Description: "Needed in order to make a snapshot rollback",
			// default is false
		},
		"timestamp": schema.Int64Attribute{
			Optional:    true,
			Computed:    true,
			Description: "Snapshot time",
		},

		// computed attributes
		"id": schema.StringAttribute{
			Computed: true,
			PlanModifiers: []planmodifier.String{
				stringplanmodifier.UseStateForUnknown(),
			},
			// id is generated as "<disk_id>#<label>"
		},
		"last_updated": schema.StringAttribute{
			Computed:    true,
			Description: "Timestamp of the last Terraform update of the disk resource.",
		},
		"guid": schema.StringAttribute{
			Computed: true,
		},
		"res_id": schema.StringAttribute{
			Computed: true,
		},
		"snap_set_guid": schema.StringAttribute{
			Computed: true,
		},
		"snap_set_time": schema.Int64Attribute{
			Computed: true,
		},
	}
}
