package de.philipphager.disclosure.database.app.model;

import com.google.auto.value.AutoValue;

@AutoValue public abstract class AppReport implements AppModel.ReportModel {
  public static final AppModel.ReportMapper MAPPER = new AppModel.ReportMapper((App, libraryCount, permissionCount) -> create(App, libraryCount, permissionCount), App.FACTORY);

  public static AppReport create(AppModel app, long libraryCount, long permissionCount) {
    //TODO: Fix whe
    return new AutoValue_AppReport((App) app, libraryCount, permissionCount);
  }

  /**
   * SqlDelight 0.6.0 alias bug in projection.
   * Tracked in Github issue 592.
   * Rename to lower case method name if fixed!
   * https://github.com/square/sqldelight/issues/592
   */
  @SuppressWarnings("PMD.MethodNamingConventions")
  public abstract App App();

  public abstract long libraryCount();

  public abstract long permissionCount();

  public boolean librariesDetected() {
    return libraryCount() > 0;
  }

  public boolean wasAnalyzed() {
    return App().analyzedAt() != null;
  }
}

@@ -246,18 +246,25 @@
 tMapper(
-(A
+%0A      (a
 pp, libr
@@ -300,19 +300,25 @@
  create(
+(
 App
+) app
 , librar
@@ -342,16 +342,22 @@
 nCount),
+%0A     
  App.FAC
@@ -400,21 +400,16 @@
 eate(App
-Model
  app, lo
@@ -453,28 +453,8 @@
 ) %7B%0A
-    //TODO: Fix whe%0A
     
@@ -484,22 +484,16 @@
 pReport(
-(App) 
 app, lib

Clean up AppReport create method