package client

import (
	"context"
)

type RequestSettings struct {
	URL         string
	Headers     map[string]string
	QueryParams map[string]string
	Body        any
	Formdata    any
}

type Response[T any, R any] struct {
	StatusCode int
	Error      *R
	Body       *T
}

func Post[T any, R any](ctx context.Context, settings *RequestSettings) (*Response[T, R], error) {
	request := buildRequest(ctx, settings)

	return makeRequest[T, R](settings.URL, request.Post)
}

func Get[T any, R any](ctx context.Context, settings *RequestSettings) (*Response[T, R], error) {
	request := buildRequest(ctx, settings)

	return makeRequest[T, R](settings.URL, request.Get)
}

func Patch[T any, R any](ctx context.Context, settings *RequestSettings) (*Response[T, R], error) {
	request := buildRequest(ctx, settings)

	return makeRequest[T, R](settings.URL, request.Patch)
}
