// Path: fiat-core/src/main/java/com/netflix/spinnaker/fiat/model/resources/Application.java
// @Component
// @Data
// @EqualsAndHashCode(callSuper = false)
// public class Application extends BaseAccessControlled<Application> implements Viewable {
//   final ResourceType resourceType = ResourceType.APPLICATION;
// 
//   private String name;
//   private Permissions permissions = Permissions.EMPTY;
// 
//   private Map<String, Object> details = new HashMap<>();
// 
//   @JsonAnySetter
//   public void setDetails(String name, Object value) {
//     this.details.put(name, value);
//   }
// 
//   @JsonIgnore
//   public View getView(Set<Role> userRoles, boolean isAdmin) {
//     return new View(this, userRoles, isAdmin);
//   }
// 
//   @Data
//   @EqualsAndHashCode(callSuper = false)
//   @NoArgsConstructor
//   public static class View extends BaseView implements Authorizable {
//     String name;
//     Set<Authorization> authorizations;
// 
//     public View(Application application, Set<Role> userRoles, boolean isAdmin) {
//       this.name = application.name;
//       if (isAdmin) {
//         this.authorizations = Authorization.ALL;
//       } else {
//         this.authorizations = application.permissions.getAuthorizations(userRoles);
//       }
//     }
//   }
// }
// 
// Path: fiat-core/src/main/java/com/netflix/spinnaker/fiat/model/resources/ServiceAccount.java
// @Component
// @Data
// @EqualsAndHashCode(callSuper = false)
// public class ServiceAccount implements Resource, Viewable {
//   private final ResourceType resourceType = ResourceType.SERVICE_ACCOUNT;
// 
//   private String name;
//   private List<String> memberOf = new ArrayList<>();
// 
//   public UserPermission toUserPermission() {
//     val roles =
//         memberOf.stream()
//             .filter(StringUtils::hasText)
//             .map(membership -> new Role(membership).setSource(Role.Source.EXTERNAL))
//             .collect(Collectors.toSet());
//     return new UserPermission().setId(name).setRoles(roles);
//   }
// 
//   public ServiceAccount setMemberOf(List<String> membership) {
//     if (membership == null) {
//       membership = new ArrayList<>();
//     }
//     memberOf =
//         membership.stream().map(String::trim).map(String::toLowerCase).collect(Collectors.toList());
//     return this;
//   }
// 
//   @JsonIgnore
//   @Override
//   public View getView(Set<Role> ignored, boolean isAdmin) {
//     return new View(this);
//   }
// 
//   @Data
//   @EqualsAndHashCode(callSuper = false)
//   @NoArgsConstructor
//   public static class View extends BaseView {
//     private String name;
//     private List<String> memberOf;
// 
//     public View(ServiceAccount serviceAccount) {
//       this.name = serviceAccount.name;
//       this.memberOf = serviceAccount.memberOf;
//     }
//   }
// }


import com.netflix.spinnaker.fiat.model.resources.Application;
import com.netflix.spinnaker.fiat.model.resources.ServiceAccount;
import java.util.List;
import retrofit.http.GET;
import retrofit.http.Query;
/*
 * Copyright 2017 Netflix, Inc.
 *
 * 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.netflix.spinnaker.fiat.providers.internal;


public interface Front50Api {
  @GET("/permissions/applications")
  List<Application> getAllApplicationPermissions();

  /**
   * @deprecated for fiat's usage this is always going to be called with restricted = false, use the
   *     no arg method instead which has the same behavior.
   */
  @GET("/v2/applications")
  @Deprecated
  List<Application> getAllApplications(@Query("restricted") boolean restricted);

  @GET("/v2/applications?restricted=false")
  List<Application> getAllApplications();

  @GET("/serviceAccounts")
// Path: fiat-core/src/main/java/com/netflix/spinnaker/fiat/model/resources/Application.java
// @Component
// @Data
// @EqualsAndHashCode(callSuper = false)
// public class Application extends BaseAccessControlled<Application> implements Viewable {
//   final ResourceType resourceType = ResourceType.APPLICATION;
// 
//   private String name;
//   private Permissions permissions = Permissions.EMPTY;
// 
//   private Map<String, Object> details = new HashMap<>();
// 
//   @JsonAnySetter
//   public void setDetails(String name, Object value) {
//     this.details.put(name, value);
//   }
// 
//   @JsonIgnore
//   public View getView(Set<Role> userRoles, boolean isAdmin) {
//     return new View(this, userRoles, isAdmin);
//   }
// 
//   @Data
//   @EqualsAndHashCode(callSuper = false)
//   @NoArgsConstructor
//   public static class View extends BaseView implements Authorizable {
//     String name;
//     Set<Authorization> authorizations;
// 
//     public View(Application application, Set<Role> userRoles, boolean isAdmin) {
//       this.name = application.name;
//       if (isAdmin) {
//         this.authorizations = Authorization.ALL;
//       } else {
//         this.authorizations = application.permissions.getAuthorizations(userRoles);
//       }
//     }
//   }
// }
// 
// Path: fiat-core/src/main/java/com/netflix/spinnaker/fiat/model/resources/ServiceAccount.java
// @Component
// @Data
// @EqualsAndHashCode(callSuper = false)
// public class ServiceAccount implements Resource, Viewable {
//   private final ResourceType resourceType = ResourceType.SERVICE_ACCOUNT;
// 
//   private String name;
//   private List<String> memberOf = new ArrayList<>();
// 
//   public UserPermission toUserPermission() {
//     val roles =
//         memberOf.stream()
//             .filter(StringUtils::hasText)
//             .map(membership -> new Role(membership).setSource(Role.Source.EXTERNAL))
//             .collect(Collectors.toSet());
//     return new UserPermission().setId(name).setRoles(roles);
//   }
// 
//   public ServiceAccount setMemberOf(List<String> membership) {
//     if (membership == null) {
//       membership = new ArrayList<>();
//     }
//     memberOf =
//         membership.stream().map(String::trim).map(String::toLowerCase).collect(Collectors.toList());
//     return this;
//   }
// 
//   @JsonIgnore
//   @Override
//   public View getView(Set<Role> ignored, boolean isAdmin) {
//     return new View(this);
//   }
// 
//   @Data
//   @EqualsAndHashCode(callSuper = false)
//   @NoArgsConstructor
//   public static class View extends BaseView {
//     private String name;
//     private List<String> memberOf;
// 
//     public View(ServiceAccount serviceAccount) {
//       this.name = serviceAccount.name;
//       this.memberOf = serviceAccount.memberOf;
//     }
//   }
// }


// Path: fiat-roles/src/main/java/com/netflix/spinnaker/fiat/providers/internal/Front50Api.java
import com.netflix.spinnaker.fiat.model.resources.Application;
import com.netflix.spinnaker.fiat.model.resources.ServiceAccount;
import java.util.List;
import retrofit.http.GET;
import retrofit.http.Query;

/*
 * Copyright 2017 Netflix, Inc.
 *
 * 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.netflix.spinnaker.fiat.providers.internal;


public interface Front50Api {
  @GET("/permissions/applications")
  List<Application> getAllApplicationPermissions();

  /**
   * @deprecated for fiat's usage this is always going to be called with restricted = false, use the
   *     no arg method instead which has the same behavior.
   */
  @GET("/v2/applications")
  @Deprecated
  List<Application> getAllApplications(@Query("restricted") boolean restricted);

  @GET("/v2/applications?restricted=false")
  List<Application> getAllApplications();

  @GET("/serviceAccounts")
  List<ServiceAccount> getAllServiceAccounts();