// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
//  HasResourcePath<T> {
// 
// }
// 
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
// 
//   private String username;
//   private String email;
//   private MeAppsResponse apps;
//   private MeKeysResponse keys;
//   @JsonProperty("id")
//   private ResourceId<Me> resourceId;
//   @JsonProperty("link")
//   private ResourcePath<Me> resourcePath;
// 
//   @Override
//   public ResourceId<Me> getResourceId() {
//     return resourceId;
//   }
// 
//   public void setResourceId(ResourceId<Me> resourceId) {
//     this.resourceId = resourceId;
//   }
// 
//   @Override
//   public ResourcePath<Me> getResourcePath() {
//     return resourcePath;
//   }
// 
//   public void setResourcePath(ResourcePath<Me> resourcePath) {
//     this.resourcePath = resourcePath;
//   }
// 
//   public String getUsername() {
//     return username;
//   }
// 
//   public void setUsername(String username) {
//     this.username = username;
//   }
// 
//   public String getEmail() {
//     return email;
//   }
// 
//   public void setEmail(String email) {
//     this.email = email;
//   }
// 
//   public MeAppsResponse getApps() {
//     return apps;
//   }
// 
//   public void setApps(MeAppsResponse apps) {
//     this.apps = apps;
//   }
// 
//   public MeKeysResponse getKeys() {
//     return keys;
//   }
// 
//   public void setKeys(MeKeysResponse keys) {
//     this.keys = keys;
//   }
// 
// }
// 
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
// 
// }
// 
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
// 
// }


import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.sun.jersey.api.client.WebResource;
package com.github.chrisprice.phonegapbuild.plugin;



/**
 * Delete any cloud apps or keys.
 * 
 * @goal scorch
 * @requiresProject false
 */
public class ScorchMojo extends AbstractPhoneGapBuildMojo {

  public void execute() throws MojoExecutionException, MojoFailureException {
    getLog().debug("Authenticating.");
    WebResource webResource = getRootWebResource();

    getLog().info("Requesting summary from cloud.");
    MeResponse me = meManager.requestMe(webResource);

    HasResourceIdAndPath<App>[] apps = me.getApps().getAll();

    getLog().info("Found " + apps.length + " apps, starting delete.");
    for (HasResourceIdAndPath<App> app : apps) {
      getLog().info("Deleting cloud app id " + app.getResourceId());
      appsManager.deleteApp(webResource, app.getResourcePath());
    }

// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
//  HasResourcePath<T> {
// 
// }
// 
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeResponse implements HasResourceIdAndPath<Me> {
// 
//   private String username;
//   private String email;
//   private MeAppsResponse apps;
//   private MeKeysResponse keys;
//   @JsonProperty("id")
//   private ResourceId<Me> resourceId;
//   @JsonProperty("link")
//   private ResourcePath<Me> resourcePath;
// 
//   @Override
//   public ResourceId<Me> getResourceId() {
//     return resourceId;
//   }
// 
//   public void setResourceId(ResourceId<Me> resourceId) {
//     this.resourceId = resourceId;
//   }
// 
//   @Override
//   public ResourcePath<Me> getResourcePath() {
//     return resourcePath;
//   }
// 
//   public void setResourcePath(ResourcePath<Me> resourcePath) {
//     this.resourcePath = resourcePath;
//   }
// 
//   public String getUsername() {
//     return username;
//   }
// 
//   public void setUsername(String username) {
//     this.username = username;
//   }
// 
//   public String getEmail() {
//     return email;
//   }
// 
//   public void setEmail(String email) {
//     this.email = email;
//   }
// 
//   public MeAppsResponse getApps() {
//     return apps;
//   }
// 
//   public void setApps(MeAppsResponse apps) {
//     this.apps = apps;
//   }
// 
//   public MeKeysResponse getKeys() {
//     return keys;
//   }
// 
//   public void setKeys(MeKeysResponse keys) {
//     this.keys = keys;
//   }
// 
// }
// 
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
// 
// }
// 
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/Key.java
// public class Key extends AbstractResource {
// 
// }


// Path: plugin/src/main/java/com/github/chrisprice/phonegapbuild/plugin/ScorchMojo.java
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.me.MeResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
import com.github.chrisprice.phonegapbuild.api.data.resources.Key;
import com.sun.jersey.api.client.WebResource;

package com.github.chrisprice.phonegapbuild.plugin;



/**
 * Delete any cloud apps or keys.
 * 
 * @goal scorch
 * @requiresProject false
 */
public class ScorchMojo extends AbstractPhoneGapBuildMojo {

  public void execute() throws MojoExecutionException, MojoFailureException {
    getLog().debug("Authenticating.");
    WebResource webResource = getRootWebResource();

    getLog().info("Requesting summary from cloud.");
    MeResponse me = meManager.requestMe(webResource);

    HasResourceIdAndPath<App>[] apps = me.getApps().getAll();

    getLog().info("Found " + apps.length + " apps, starting delete.");
    for (HasResourceIdAndPath<App> app : apps) {
      getLog().info("Deleting cloud app id " + app.getResourceId());
      appsManager.deleteApp(webResource, app.getResourcePath());
    }

    HasResourceIdAndPath<Key>[] iosKeys = me.getKeys().getIos().getAll();