package kvmvm

import (
	"context"

	log "github.com/sirupsen/logrus"
)

func resourceCompueteStateUpgradeV1(ctx context.Context, rawState map[string]interface{}, meta any) (map[string]interface{}, error) {
	log.Debug("resourceCompueteStateUpgradeV1: upgrading state")
	if oldVal, ok := rawState["pinned"].(bool); ok {
		if !oldVal {
			rawState["pinned"] = -1
		} else {
			rawState["pinned"] = 0
		}
	}

	return rawState, nil
}
