package finger

import (
	"bytes"
	"io"
	"strings"

	"tildegit.org/tjp/sliderule/internal/types"
)

// Error produces a finger Response containing the error message and Status 1.
func Error(msg string) *types.Response {
	if !strings.HasSuffix(msg, "\r\n") {
		msg += "\r\n"
	}
	return &types.Response{Body: bytes.NewBufferString(msg), Status: 1}
}

// Success produces a finger response with a Status of 0.
func Success(body io.Reader) *types.Response {
	return &types.Response{Body: body}
}