/*
 * Copyright 2015 Shredder121.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.shredder121.gh_event_api.handler.pull_request;

import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.shredder121.gh_event_api.model.Label;
import com.github.shredder121.gh_event_api.model.PullRequest;
import com.github.shredder121.gh_event_api.model.User;

/**
 * The payload passed when a {@code pull_request} event is received.
 *
 * @author Shredder121
 */
public class PullRequestPayload {

    @NotNull private final String action;
    @NotNull private final Integer number;
    @NotNull private final PullRequest pull_request;

    //contextual properties
    private Label label;
    private User user;

    @JsonCreator
    public PullRequestPayload(
            @JsonProperty("action") String action,
            @JsonProperty("number") Integer number,
            @JsonProperty("pull_request") PullRequest pull_request) {

        this.action = action;
        this.number = number;
        this.pull_request = pull_request;
    }

    public String getAction() {
        return action;
    }

    public Integer getNumber() {
        return number;
    }

    public PullRequest getPullRequest() {
        return pull_request;
    }

    /**
     * If the {@link #action action} of the event is
     * {@link PullRequestEvent#LABELED labeled}
     * or
     * {@link PullRequestEvent#UNLABELED unlabeled}
     * the label is included.
     *
     * @return the label if included, else {@code null}.
     */
    public Label getLabel() {
        return label;
    }

    private void setLabel(Label label) {
        this.label = label;
    }

    /**
     * If the {@link #action action} of the event is
     * {@link PullRequestEvent#ASSIGNED assigned}
     * or
     * {@link PullRequestEvent#UNASSIGNED unassigned}
     * the user is included.
     *
     * @return the user if included, else {@code null}.
     */
    public User getUser() {
        return user;
    }

    private void setUser(User user) {
        this.user = user;
    }
}

@@ -928,16 +928,77 @@
 equest;%0A
+import com.github.shredder121.gh_event_api.model.Repository;%0A
 import c
@@ -1044,16 +1044,16 @@
 l.User;%0A
-
 %0A/**%0A * 
@@ -1320,16 +1320,106 @@
 request;
+%0A    @NotNull private final Repository repository;%0A    @NotNull private final User sender;
 %0A%0A    //
@@ -1706,16 +1706,128 @@
 _request
+,%0A            @JsonProperty(%22repository%22) Repository repository,%0A            @JsonProperty(%22sender%22) User sender
 ) %7B%0A%0A   
@@ -1917,32 +1917,100 @@
 = pull_request;%0A
+        this.repository = repository;%0A        this.sender = sender;%0A
     %7D%0A%0A    publi
@@ -2163,24 +2163,24 @@
 Request() %7B%0A
-
         retu
@@ -2195,32 +2195,166 @@
 request;%0A    %7D%0A%0A
+    public Repository getRepository() %7B%0A        return repository;%0A    %7D%0A%0A    public User getSender() %7B%0A        return sender;%0A    %7D%0A%0A
     /**%0A     * I

Add the repository and sender properties