package com.getbootstrap.lmvtfy.github

import spray.json.{JsonFormat, DefaultJsonProtocol}
import spray.httpx.SprayJsonSupport

case class GitHubUser(login: String)
case class IssueOrComment(
  body: String,
  user: GitHubUser
)
case class IssueOrCommentEvent(
  action: String, // issue_comment: "opened", "closed", "reopened"; issue: "created"
  comment: Option[IssueOrComment],
  issue: IssueOrComment
)

object GitHubJsonProtocol extends DefaultJsonProtocol with SprayJsonSupport {
  implicit val gitHubUserFormat = jsonFormat1(GitHubUser.apply)
  implicit val issueOrCommentFormat = jsonFormat2(IssueOrComment.apply)
  implicit val issueOrCommentEventFormat = jsonFormat3(IssueOrCommentEvent.apply)
}

package com.getbootstrap.lmvtfy.github

import spray.json.{JsonFormat, DefaultJsonProtocol}
import spray.httpx.SprayJsonSupport

case class GitHubUser(login: String)
case class IssueOrComment(
  body: String,
  user: GitHubUser
)
case class IssueOrCommentEvent(
  action: String, // issue_comment: "opened", "closed", "reopened"; issue: "created"
  //comment: Option[IssueOrComment],
  issue: IssueOrComment
)

object GitHubJsonProtocol extends DefaultJsonProtocol with SprayJsonSupport {
  implicit val gitHubUserFormat = jsonFormat1(GitHubUser.apply)
  implicit val issueOrCommentFormat = jsonFormat2(IssueOrComment.apply)
  implicit val issueOrCommentEventFormat = jsonFormat2(IssueOrCommentEvent.apply)
}

--- 
+++ 
@@ -10,12 +10,12 @@
 )
 case class IssueOrCommentEvent(
   action: String, // issue_comment: "opened", "closed", "reopened"; issue: "created"
-  //comment: Option[IssueOrComment],
+  comment: Option[IssueOrComment],
   issue: IssueOrComment
 )
 
 object GitHubJsonProtocol extends DefaultJsonProtocol with SprayJsonSupport {
   implicit val gitHubUserFormat = jsonFormat1(GitHubUser.apply)
   implicit val issueOrCommentFormat = jsonFormat2(IssueOrComment.apply)
-  implicit val issueOrCommentEventFormat = jsonFormat2(IssueOrCommentEvent.apply)
+  implicit val issueOrCommentEventFormat = jsonFormat3(IssueOrCommentEvent.apply)
 }
Revert "TEMPORARY: see whether the Option is screwing things up"

This reverts commit fb0637431cd6e95d6354b07f661bb8c4a1d280cb.
