export default (
  entry: {
    method: string;
    details: {
      type: Record<string, Record<string, string>>;
      documentation: string[];
    };
  },
  testnet: boolean
) => {
  let value = `### ${entry.method}(`;

  const type = Object.keys(entry.details.type)[0];

  if (type === "Plain") {
    value += `): Promise&lt;${entry.details.type[type]}&gt;`;
  } else if (type === "Map") {
    value += `key: ${entry.details.type[type].key}): Promise&lt;${entry.details.type[type].value}&gt;`;
  } else if (type === "DoubleMap") {
    value += `key1: ${entry.details.type[type].key1}, key2: ${entry.details.type[type].key2}): Promise&lt;${entry.details.type[type].value}&gt;`;
  }

  value += "  \n\n";

  if (testnet) {
    value += "_Testnet only_  \n";
  }

  if (entry.details.documentation.length) {
    value += `${entry.details.documentation.join("  \n")}  \n\n`;
  }

  return value;
};
