package output

import (
	"bytes"
	"io"

	"git.bissendorf.co/bissendorf/unifood/m/v2/core/interfaces"
	"github.com/goccy/go-yaml"
)

type YamlFormatter struct{}

func (f *YamlFormatter) Format(list *interfaces.ResourceList) (io.Reader, error) {
	buffer, err := yaml.Marshal(list)
	if err != nil {
		return nil, err
	}

	return bytes.NewBuffer(buffer), nil
}
