package acsgroups

import (
	"context"
	"net/http"

	"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
	"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)

// UserDeleteRequest struct to userDelete access group
type UserDeleteRequest struct {
	// Comment of the access group
	// Required: true
	GroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`

	// User ID
	// Required: true
	UserID string `url:"user_id" json:"user_id" validate:"required"`
}

// UserDelete a access groups
func (i AccessGroups) UserDelete(ctx context.Context, req UserDeleteRequest) (bool, error) {
	err := validators.ValidateRequest(req)
	if err != nil {
		return false, validators.ValidationErrors(validators.GetErrors(err))
	}

	url := "/sdn/access_group/user_delete"

	_, err = i.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req)
	if err != nil {
		return false, err
	}

	return true, nil
}
