text: // Generated by CoffeeScript 1.8.0
  (function() {
    var actionObject, actionTarget, actions, avatarSize, dataObject, errorObject, imageObject, objectTranslators, personObject, prefix, resultForNotification, url, validNotificationToActivity, verbObject;
  
    prefix = 'trello';
  
    url = 'http://trello.com';
  
    avatarSize = 170;
  
    actions = {
      commentCard: {
        displayName: 'commented on card',
        object: 'card'
      },
      removedFromCard: {
        displayName: 'removed from card',
        object: 'card'
      },
      addedToCard: {
        displayName: 'added to card',
        object: 'card'
      },
      changeCard: {
        displayName: 'changed card',
        object: 'card'
      },
      mentionedOnCard: {
        displayName: 'mentioned on card',
        object: 'card'
      },
      cardDueSoon: {
        displayName: 'card due soon',
        object: 'card'
      },
      addedToBoard: {
        displayName: 'added to board',
        object: 'board'
      }
    };
  
    objectTranslators = {
      board: function(board) {
        var output;
        output = {
          objectType: "" + prefix + ".board",
          id: "" + prefix + "." + board.id,
          displayName: board.name
        };
        if (board.shortLink) {
          output.url = "" + url + "/b/" + board.shortLink;
        }
        return output;
      },
      card: function(card) {
        var output;
        output = {
          objectType: "" + prefix + ".card",
          id: "" + prefix + "." + card.id,
          url: "" + url + "/c/" + card.shortLink,
          displayName: card.name
        };
        if (card.due) {
          output.endTime = card.due;
        }
        return output;
      }
    };
  
    personObject = function(person) {
      var output;
      if (person) {
        output = {
          objectType: "person",
          id: "" + prefix + "." + person.username,
          displayName: person.fullName,
          url: "" + url + "/" + person.username
        };
        if (person.avatarHash) {
          output.image = imageObject(person.avatarHash);
        }
        return output;
      }
    };
  
    imageObject = function(avatarHash) {
      return {
        url: "https://trello-avatars.s3.amazonaws.com/" + avatarHash + "/" + avatarSize + ".png",
        mediaType: "image/jpeg",
        width: avatarSize,
        height: avatarSize
      };
    };
  
    verbObject = function(notificationType) {
      return {
        id: "trello." + notificationType,
        displayName: actions[notificationType].displayName
      };
    };
  
    resultForNotification = function(notification) {
      if (notification.type === 'commentCard') {
        return {
          text: notification.data.text
        };
      }
    };
  
    dataObject = function(objectType, notification) {
      var objectData, objectMethod;
      objectData = notification.data[objectType];
      objectMethod = objectTranslators[objectType];
      return objectMethod(objectData);
    };
  
    actionObject = function(notification) {
      var objectData, objectMethod, objectType;
      objectType = actions[notification.type].object;
      objectData = notification.data[objectType];
      objectMethod = objectTranslators[objectType];
      return objectMethod(objectData);
    };
  
    actionTarget = function(notification) {
      var objectType, targetType;
      objectType = actions[notification.type].object;
      if (objectType === 'card') {
        targetType = 'board';
        return dataObject('board', notification);
      } else {
        return null;
      }
    };
  
    validNotificationToActivity = function(notification) {
      var actor, output, result, target;
      result = resultForNotification(notification);
      target = actionTarget(notification);
      actor = personObject(notification.memberCreator);
      output = {
        verb: verbObject(notification.type),
        published: notification.date,
        language: "en",
        object: actionObject(notification)
      };
      if (actor) {
        output.actor = actor;
      }
      if (target) {
        output.target = target;
      }
      if (result) {
        output.result = result;
      }
      return output;
    };
  
    errorObject = function(original) {
      return {
        error: 'unknown_notification_type',
        originalObject: original
      };
    };
  
    module.exports = function(notification) {
      if (notification.type && actions[notification.type]) {
        return validNotificationToActivity(notification);
      } else {
        return errorObject(notification);
      }
    };
  
  }).call(this);
  