// Code generated by protoc-gen-typescript-http. DO NOT EDIT.
/* eslint-disable camelcase */
// @ts-nocheck

// Admin is the admin message.
export type Admin = {
  // The unique ID of the user.
  id: number | undefined;
  // The name of the user.
  name: string | undefined;
  // The email of the user.
  email: string | undefined;
  // The phone number of the user.
  phone: string | undefined;
  // The avatar URL of the user.
  avatar: string | undefined;
  // The access level of the user.
  // Possible values are: "admin", "user", etc.
  access: string | undefined;
  // The password of the user.
  password: string | undefined;
  // The timestamp at which the user was created.
  createTime: wellKnownTimestamp | undefined;
  // The latest timestamp at which the user was updated.
  updateTime: wellKnownTimestamp | undefined;
};

// Encoded using RFC 3339, where generated output will always be Z-normalized
// and uses 0, 3, 6 or 9 fractional digits.
// Offsets other than "Z" are also accepted.
type wellKnownTimestamp = string;

// AdminSet is the set of admins.
export type AdminSet = {
  // The set of admins.
  admins: Admin[] | undefined;
  // The next page token.
  nextPageToken: string | undefined;
};

// LoginRequest is the request message for the Login method.
export type LoginRequest = {
  // Required. Password of the user.
  //
  // Behaviors: REQUIRED
  password: string | undefined;
  username?: string;
  email?: string;
};

// GetAdminRequest is the request message for the GetAdmin method.
export type GetAdminRequest = {
  // The ID of the admin to retrieve.
  //
  // Behaviors: REQUIRED
  id: number | undefined;
};

// ListAdminsResponse is the response message for the ListAdmins method.
export type ListAdminsRequest = {
  // Optional. The number of admins per page.
  pageSize: number | undefined;
  // Optional. The page token.
  pageToken: string | undefined;
  // Optional. The standard list filter.
  // Supported fields:
  // * `name` (i.e. `name="John Doe"`)
  // * `create_time` range (i.e. `timestamp>="2025-01-31T11:30:00-04:00"` where
  // the timestamp is in RFC 3339 format)
  // More detail in [AIP-160](https://google.aip.dev/160).
  filter: string | undefined;
  // Optional. A comma-separated list of fields to order by, sorted in ascending
  // order. Use "desc" after a field name for descending. Supported fields:
  // - `create_time`
  // Example: `create_time desc`.
  orderBy: string | undefined;
};

// CreateAdminRequest is the request message for the CreateAdmin method.
export type CreateAdminRequest = {
  // Required. The admin to create.
  //
  // Behaviors: REQUIRED
  admin: Admin | undefined;
};

// UpdateAdminRequest is the request message for the UpdateAdmin method.
export type UpdateAdminRequest = {
  // Required. The admin to update.
  //
  // Behaviors: REQUIRED
  admin: Admin | undefined;
  // Required. Mask of fields to update.
  //
  // Behaviors: REQUIRED
  updateMask: wellKnownFieldMask | undefined;
};

// In JSON, a field mask is encoded as a single string where paths are
// separated by a comma. Fields name in each path are converted
// to/from lower-camel naming conventions.
// As an example, consider the following message declarations:
//
//     message Profile {
//       User user = 1;
//       Photo photo = 2;
//     }
//     message User {
//       string display_name = 1;
//       string address = 2;
//     }
//
// In proto a field mask for `Profile` may look as such:
//
//     mask {
//       paths: "user.display_name"
//       paths: "photo"
//     }
//
// In JSON, the same mask is represented as below:
//
//     {
//       mask: "user.displayName,photo"
//     }
type wellKnownFieldMask = string;

// DeleteAdminRequest is the request message for the DeleteAdmin method.
export type DeleteAdminRequest = {
  // Required. The ID of the admin to delete.
  //
  // Behaviors: REQUIRED
  id: number | undefined;
};

// AdminService is the admin service definition.
export interface AdminService {
  // Login a user and return the username.
  Login(request: LoginRequest): Promise<Admin>;
  // Logout the currently logged-in user.
  Logout(request: wellKnownEmpty): Promise<wellKnownEmpty>;
  // Current returns the currently logged-in user.
  Current(request: wellKnownEmpty): Promise<Admin>;
  // ListAdmins returns a list of admins.
  ListAdmins(request: ListAdminsRequest): Promise<AdminSet>;
  // CreateAdmin creates a new admin.
  CreateAdmin(request: CreateAdminRequest): Promise<Admin>;
  // UpdateAdmin updates an existing admin.
  UpdateAdmin(request: UpdateAdminRequest): Promise<Admin>;
  // DeleteAdmin deletes an admin by ID.
  DeleteAdmin(request: DeleteAdminRequest): Promise<wellKnownEmpty>;
  // GetAdmin retrieves an admin by ID.
  GetAdmin(request: GetAdminRequest): Promise<Admin>;
}

type RequestType = {
  path: string;
  method: string;
  body: string | null;
};

type RequestHandler = (request: RequestType, meta: { service: string, method: string }) => Promise<unknown>;

export function createAdminServiceClient(
  handler: RequestHandler
): AdminService {
  return {
    Login(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
      const path = `v1/admins/login`; // eslint-disable-line quotes
      const body = JSON.stringify(request);
      const queryParams: string[] = [];
      let uri = path;
      if (queryParams.length > 0) {
        uri += `?${queryParams.join("&")}`
      }
      return handler({
        path: uri,
        method: "POST",
        body,
      }, {
        service: "AdminService",
        method: "Login",
      }) as Promise<Admin>;
    },
    Logout(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
      const path = `v1/admins/logout`; // eslint-disable-line quotes
      const body = JSON.stringify(request);
      const queryParams: string[] = [];
      let uri = path;
      if (queryParams.length > 0) {
        uri += `?${queryParams.join("&")}`
      }
      return handler({
        path: uri,
        method: "POST",
        body,
      }, {
        service: "AdminService",
        method: "Logout",
      }) as Promise<wellKnownEmpty>;
    },
    Current(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
      const path = `v1/admins/current`; // eslint-disable-line quotes
      const body = null;
      const queryParams: string[] = [];
      let uri = path;
      if (queryParams.length > 0) {
        uri += `?${queryParams.join("&")}`
      }
      return handler({
        path: uri,
        method: "GET",
        body,
      }, {
        service: "AdminService",
        method: "Current",
      }) as Promise<Admin>;
    },
    ListAdmins(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
      const path = `v1/admins/list`; // eslint-disable-line quotes
      const body = null;
      const queryParams: string[] = [];
      if (request.pageSize) {
        queryParams.push(`pageSize=${encodeURIComponent(request.pageSize.toString())}`)
      }
      if (request.pageToken) {
        queryParams.push(`pageToken=${encodeURIComponent(request.pageToken.toString())}`)
      }
      if (request.filter) {
        queryParams.push(`filter=${encodeURIComponent(request.filter.toString())}`)
      }
      if (request.orderBy) {
        queryParams.push(`orderBy=${encodeURIComponent(request.orderBy.toString())}`)
      }
      let uri = path;
      if (queryParams.length > 0) {
        uri += `?${queryParams.join("&")}`
      }
      return handler({
        path: uri,
        method: "GET",
        body,
      }, {
        service: "AdminService",
        method: "ListAdmins",
      }) as Promise<AdminSet>;
    },
    CreateAdmin(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
      const path = `v1/admins/create`; // eslint-disable-line quotes
      const body = JSON.stringify(request?.admin ?? {});
      const queryParams: string[] = [];
      let uri = path;
      if (queryParams.length > 0) {
        uri += `?${queryParams.join("&")}`
      }
      return handler({
        path: uri,
        method: "POST",
        body,
      }, {
        service: "AdminService",
        method: "CreateAdmin",
      }) as Promise<Admin>;
    },
    UpdateAdmin(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
      const path = `v1/admins/update`; // eslint-disable-line quotes
      const body = JSON.stringify(request?.admin ?? {});
      const queryParams: string[] = [];
      if (request.updateMask) {
        queryParams.push(`updateMask=${encodeURIComponent(request.updateMask.toString())}`)
      }
      let uri = path;
      if (queryParams.length > 0) {
        uri += `?${queryParams.join("&")}`
      }
      return handler({
        path: uri,
        method: "PUT",
        body,
      }, {
        service: "AdminService",
        method: "UpdateAdmin",
      }) as Promise<Admin>;
    },
    DeleteAdmin(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
      if (!request.id) {
        throw new Error("missing required field request.id");
      }
      const path = `v1/admins/${request.id}`; // eslint-disable-line quotes
      const body = null;
      const queryParams: string[] = [];
      let uri = path;
      if (queryParams.length > 0) {
        uri += `?${queryParams.join("&")}`
      }
      return handler({
        path: uri,
        method: "DELETE",
        body,
      }, {
        service: "AdminService",
        method: "DeleteAdmin",
      }) as Promise<wellKnownEmpty>;
    },
    GetAdmin(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
      if (!request.id) {
        throw new Error("missing required field request.id");
      }
      const path = `v1/admins/${request.id}`; // eslint-disable-line quotes
      const body = null;
      const queryParams: string[] = [];
      let uri = path;
      if (queryParams.length > 0) {
        uri += `?${queryParams.join("&")}`
      }
      return handler({
        path: uri,
        method: "GET",
        body,
      }, {
        service: "AdminService",
        method: "GetAdmin",
      }) as Promise<Admin>;
    },
  };
}
// An empty JSON object
type wellKnownEmpty = Record<never, never>;


// @@protoc_insertion_point(typescript-http-eof)
