// Copyright (C) 2018 The Android Open Source Project
//
// 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.googlesource.gerrit.plugins.its.phabricator.conduit.results;

import com.google.gson.JsonElement;

/**
 * Models the result for a call to maniphest.search
 *
 * <p>JSON looks like:
 *
 * <pre>
 * {
 *   "id": 1,
 *   "type": "TASK",
 *   "phid": "PHID-TASK-qu55xzt7g5gusqkdiv5r",
 *   "fields": {
 *     "name": "First task",
 *     "description": {
 *       "raw": "Test"
 *     },
 *     "authorPHID": "PHID-USER-aruq7lrst6el3od2jpgm",
 *     "ownerPHID": null,
 *     "status": {
 *       "value": "open",
 *       "name": "Open",
 *       "color": null
 *     },
 *     "priority": {
 *       "value": 100,
 *       "subpriority": 0,
 *       "name": "Unbreak Now!",
 *       "color": "pink"
 *     },
 *     "points": null,
 *     "subtype": "default",
 *     "closerPHID": null,
 *     "dateClosed": null,
 *     "spacePHID": null,
 *     "dateCreated": 1530558541,
 *     "dateModified": 1538054886,
 *     "policy": {
 *       "view": "public",
 *       "interact": "public",
 *       "edit": "users"
 *     },
 *   },
 *   "attachments": {
 *     "projects": {
 *       "projectPHIDs": [
 *         "PHID-PROJ-ro6wrekgi7u3fwzz5p6a"
 *       ]
 *     }
 *   }
 * }
 * </pre>
 */
public class ManiphestSearch {
  private int id;
  private JsonElement fields;
  private Attachments attachments;

  public int getId() {
    return id;
  }

  public JsonElement getFields() {
    return fields;
  }

  public Attachments getAttachments() {
    return attachments;
  }

  public class Attachments {
    private Projects projects;

    public Projects getProjects() {
      return projects;
    }
  }

  public class Projects {
    private JsonElement projectPHIDs;

    public JsonElement getProjectPHIDs() {
      return projectPHIDs;
    }
  }
}

@@ -680,45 +680,8 @@
 s;%0A%0A
-import com.google.gson.JsonElement;%0A%0A
 /**%0A
@@ -1817,516 +1817,46 @@
 id;%0A
-  private JsonElement fields;%0A  private Attachments attachments;%0A%0A  public int getId() %7B%0A    return id;%0A  %7D%0A%0A  public JsonElement getFields() %7B%0A    return fields;%0A  %7D%0A%0A  public Attachments getAttachments() %7B%0A    return attachments;%0A  %7D%0A%0A  public class Attachments %7B%0A    private Projects projects;%0A%0A    public Projects getProjects() %7B%0A      return projects;%0A    %7D%0A  %7D%0A%0A  public class Projects %7B%0A    private JsonElement projectPHIDs;%0A%0A    public JsonElement getProjectPHIDs() %7B%0A      return projectPHIDs;%0A    %7D
+%0A  public int getId() %7B%0A    return id;
 %0A  %7D

Simplify ManiphestSearch