/**
 * @packageDocumentation
 * @module api.functional.vbanks
 * @nestia Generated by Nestia - https://github.com/samchon/nestia
 */
//================================================================
import type { IConnection } from "@nestia/fetcher";
import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher";

import type { IIamportResponse } from "../../structures/IIamportResponse";
import type { IIamportVBankPayment } from "../../structures/IIamportVBankPayment";

/**
 * 가상 계좌 발급하기.
 *
 * @param input 가상 계좌 입력 정보
 * @returns 가상 계좌 결제 정보
 * @security bearer
 * @author Samchon
 *
 * @controller FakeIamportVbanksController.create
 * @path POST /vbanks
 * @nestia Generated by Nestia - https://github.com/samchon/nestia
 */
export async function create(
  connection: IConnection,
  input: IIamportVBankPayment.ICreate,
): Promise<create.Output> {
  return PlainFetcher.fetch(
    {
      ...connection,
      headers: {
        ...connection.headers,
        "Content-Type": "application/json",
      },
    },
    {
      ...create.METADATA,
      template: create.METADATA.path,
      path: create.path(),
    },
    input,
  );
}
export namespace create {
  export type Input = IIamportVBankPayment.ICreate;
  export type Output = IIamportResponse<IIamportVBankPayment>;

  export const METADATA = {
    method: "POST",
    path: "/vbanks",
    request: {
      type: "application/json",
      encrypted: false,
    },
    response: {
      type: "application/json",
      encrypted: false,
    },
    status: 201,
  } as const;

  export const path = () => "/vbanks";
}

/**
 * 가상 계좌 편집하기.
 *
 * @param input 가상 계좌 편집 입력 정보
 * @returns 편집된 가상 계좌 결제 정보
 * @security bearer
 * @author Samchon
 *
 * @controller FakeIamportVbanksController.update
 * @path PUT /vbanks
 * @nestia Generated by Nestia - https://github.com/samchon/nestia
 */
export async function update(
  connection: IConnection,
  input: IIamportVBankPayment.IUpdate,
): Promise<update.Output> {
  return PlainFetcher.fetch(
    {
      ...connection,
      headers: {
        ...connection.headers,
        "Content-Type": "application/json",
      },
    },
    {
      ...update.METADATA,
      template: update.METADATA.path,
      path: update.path(),
    },
    input,
  );
}
export namespace update {
  export type Input = IIamportVBankPayment.IUpdate;
  export type Output = IIamportResponse<IIamportVBankPayment>;

  export const METADATA = {
    method: "PUT",
    path: "/vbanks",
    request: {
      type: "application/json",
      encrypted: false,
    },
    response: {
      type: "application/json",
      encrypted: false,
    },
    status: 200,
  } as const;

  export const path = () => "/vbanks";
}
