 import Tailor
 import Sugar
 
-// The type of the notification.
-//
-// OCTNotificationTypeUnknown     - An unknown type of notification.
-// OCTNotificationTypeIssue       - A new issue, or a new comment on one.
-// OCTNotificationTypePullRequest - A new pull request, or a new comment on one.
-// OCTNotificationTypeCommit      - A new comment on a commit.
-public enum NotificationType: String {
-  case Unknown = ""
-  case Issue = "Issue"
-  case PullRequest = "PullRequest"
-  case Commit = "Commit"
-}
-
 // A notification of some type of activity.
 public class Notification: Object {
+
+  // The type of the notification.
+  //
+  // OCTNotificationTypeUnknown     - An unknown type of notification.
+  // OCTNotificationTypeIssue       - A new issue, or a new comment on one.
+  // OCTNotificationTypePullRequest - A new pull request, or a new comment on one.
+  // OCTNotificationTypeCommit      - A new comment on a commit.
+  public enum Type: String {
+    case Unknown = ""
+    case Issue = "Issue"
+    case PullRequest = "PullRequest"
+    case Commit = "Commit"
+  }
   
   // The title of the notification.
   public private(set) var title: String = ""

  public private(set) var latestCommentURL: NSURL?
  
  // The notification type.
  public private(set) var type: NotificationType = .Unknown
  
  // The repository to which the notification belongs.
  public private(set) var repository: Repository?

    self.threadURL <- map.transform("url", transformer: Transformer.stringToURL)
    self.subjectURL <- subject?.transform("url", transformer: Transformer.stringToURL)
    self.latestCommentURL <- subject?.transform("latest_comment_url", transformer: Transformer.stringToURL)
    self.type = subject?.`enum`("type") ?? .Unknown
    self.repository = map.relation("repository")
    self.lastUpdatedDate = map.transform("updated_at", transformer: Transformer.stringToDate)
  }
}
