package apirequest

import (
	"fmt"
	"net/http"

	"codeberg.org/vlbeaudoin/voki"
	"codeberg.org/vlbeaudoin/voki/request"
	"git.agecem.com/agecem/agecem-org/apiresponse"
)

var _ request.Requester[apiresponse.V1SpecGET] = V1SpecGET{}

type V1SpecGET struct{}

func NewV1SpecGET() (request V1SpecGET, err error) {
	return
}

func (request V1SpecGET) Complete() bool { return true }

func (request V1SpecGET) Request(v *voki.Voki) (response apiresponse.V1SpecGET, err error) {
	if !request.Complete() {
		err = fmt.Errorf("Incomplete V1SpecGET")
		return
	}

	return response, v.UnmarshalIfComplete(http.MethodGet, "/v1/spec", nil, true, &response)
}
