text: // Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE
  'use strict';
  
  var Args$FarmisenBranchName = require("./Args.bs.js");
  var Jira$FarmisenBranchName = require("./Jira.bs.js");
  var Name$FarmisenBranchName = require("./Name.bs.js");
  var Banner$FarmisenBranchName = require("./Banner.bs.js");
  var Config$FarmisenBranchName = require("./Config.bs.js");
  var Gitlab$FarmisenBranchName = require("./Gitlab.bs.js");
  var Clubhouse$FarmisenBranchName = require("./Clubhouse.bs.js");
  
  function onOk(id, projectConfig, server) {
    var tmp;
    switch (server.TAG | 0) {
      case /* Clubhouse */0 :
          tmp = Clubhouse$FarmisenBranchName.getStoryName(id, server._0);
          break;
      case /* Jira */1 :
          tmp = Jira$FarmisenBranchName.getStoryName(id, server._0, server._1, server._2);
          break;
      case /* Gitlab */2 :
          tmp = Gitlab$FarmisenBranchName.getStoryName(id, server._0, server._1, server._2);
          break;
      
    }
    return tmp.then(function (maybeName) {
                  if (maybeName.TAG) {
                    Banner$FarmisenBranchName.show(maybeName._0);
                    return Promise.resolve({
                                TAG: /* Error */1,
                                _0: undefined
                              });
                  }
                  var branchName = Name$FarmisenBranchName.make(id, maybeName._0, projectConfig);
                  console.log(branchName);
                  return Promise.resolve({
                              TAG: /* Ok */0,
                              _0: undefined
                            });
                }).catch(function (param) {
                Banner$FarmisenBranchName.show("unknown failure");
                return Promise.resolve({
                            TAG: /* Error */1,
                            _0: undefined
                          });
              });
  }
  
  function onError(message) {
    Banner$FarmisenBranchName.show(message);
    return Promise.resolve({
                TAG: /* Error */1,
                _0: undefined
              });
  }
  
  function onNamebranch(id, projectConfig) {
    var server = Config$FarmisenBranchName.server(projectConfig);
    if (server.TAG) {
      return onError(server._0);
    } else {
      return onOk(id, projectConfig, server._0);
    }
  }
  
  function onHelp(message) {
    Banner$FarmisenBranchName.show(message);
    return Promise.resolve({
                TAG: /* Error */1,
                _0: undefined
              });
  }
  
  function onDoc(param) {
    Banner$FarmisenBranchName.doc(undefined);
    return Promise.resolve({
                TAG: /* Ok */0,
                _0: undefined
              });
  }
  
  function cli(param) {
    var message = Args$FarmisenBranchName.parseArgs(undefined);
    if (typeof message === "number") {
      Banner$FarmisenBranchName.doc(undefined);
      return Promise.resolve({
                  TAG: /* Ok */0,
                  _0: undefined
                });
    }
    if (!message.TAG) {
      return onNamebranch(message._0, message._1);
    }
    Banner$FarmisenBranchName.show(message._0);
    return Promise.resolve({
                TAG: /* Error */1,
                _0: undefined
              });
  }
  
  exports.onOk = onOk;
  exports.onError = onError;
  exports.onNamebranch = onNamebranch;
  exports.onHelp = onHelp;
  exports.onDoc = onDoc;
  exports.cli = cli;
  /* Args-FarmisenBranchName Not a pure module */
  