import { api } from "./api";
import type { Nullable } from "./apiTypes.ts";
import type * as users from "./users.ts";

// Typescript: TSEndpoint= path=/api/admin/users/block; name=blockUser; method=PUT; request=admin.BlockUserRequest; response=users.User

// /Users/fabio/CODE/omnimed/go-quasar-partial-ssr/backend/internal/admin/routes.go Line: 14
export const blockUser = async (
  data: BlockUserRequest,
): Promise<{ data: users.User; error: Nullable<string> }> => {
  return (await api.PUT("/api/admin/users/block", data)) as {
    data: users.User;
    error: Nullable<string>;
  };
};

// Typescript: TSEndpoint= path=/api/admin/users; name=listUsers; method=POST; request=admin.ListUsersRequest; response=admin.ListUsersResponse

// /Users/fabio/CODE/omnimed/go-quasar-partial-ssr/backend/internal/admin/routes.go Line: 11
export const listUsers = async (
  data: ListUsersRequest,
): Promise<{ data: ListUsersResponse; error: Nullable<string> }> => {
  return (await api.POST("/api/admin/users", data)) as {
    data: ListUsersResponse;
    error: Nullable<string>;
  };
};

export interface ListUsersRequest {
  page: number;
  pageSize: number;
}

export interface ListUsersResponse {
  items: users.User[];
  page: number;
  pageSize: number;
}

export interface BlockUserRequest {
  uuid: string;
  action: string;
}
