package com.justeat.mickeydb.generator;

import com.google.inject.Inject;
import com.justeat.mickeydb.MickeyDatabaseModel;
import com.justeat.mickeydb.Strings;
import com.justeat.mickeydb.generator.SqliteDatabaseSnapshot;
import com.justeat.mickeydb.generator.SqliteDatabaseStatementGenerator;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;

@SuppressWarnings("all")
public class SqliteOpenHelperGenerator {
  @Inject
  @Extension
  private SqliteDatabaseStatementGenerator _sqliteDatabaseStatementGenerator;
  
  public CharSequence generate(final MickeyDatabaseModel model) {
    throw new Error("Unresolved compilation problems:"
      + "\nThe method getSnapshot() from the type MickeyDatabaseModel refers to the missing type SqliteDatabaseSnapshot"
      + "\nThe field MickeyDatabaseModel.migrations refers to the missing type MigrationBlock"
      + "\nThe field MickeyDatabaseModel.migrations refers to the missing type MigrationBlock"
      + "\nThe field MickeyDatabaseModel.migrations refers to the missing type MigrationBlock"
      + "\nThe field MickeyDatabaseModel.initTables refers to the missing type CreateTableStatement"
      + "\nThe field MickeyDatabaseModel.initViews refers to the missing type CreateViewStatement"
      + "\nThe field MickeyDatabaseModel.initTables refers to the missing type CreateTableStatement"
      + "\nThe field MickeyDatabaseModel.initViews refers to the missing type CreateViewStatement"
      + "\nThe method generateStatements(Iterable<DDLStatement>) from the type SqliteDatabaseStatementGenerator refers to the missing type DDLStatement"
      + "\nThe field MickeyDatabaseModel.initTables refers to the missing type CreateTableStatement"
      + "\nThe method generateStatements(Iterable<DDLStatement>) from the type SqliteDatabaseStatementGenerator refers to the missing type DDLStatement"
      + "\nThe field MickeyDatabaseModel.initViews refers to the missing type CreateViewStatement"
      + "\nThe field MickeyDatabaseModel.migrations refers to the missing type MigrationBlock"
      + "\nThe field MickeyDatabaseModel.migrations refers to the missing type MigrationBlock"
      + "\nThe field MickeyDatabaseModel.migrations refers to the missing type MigrationBlock"
      + "\nThe field MickeyDatabaseModel.migrations refers to the missing type MigrationBlock"
      + "\nname cannot be resolved"
      + "\npascalize cannot be resolved"
      + "\ntables cannot be resolved"
      + "\nname cannot be resolved"
      + "\nunderscore cannot be resolved"
      + "\ntoUpperCase cannot be resolved"
      + "\nname cannot be resolved"
      + "\nviews cannot be resolved"
      + "\nname cannot be resolved"
      + "\nunderscore cannot be resolved"
      + "\ntoUpperCase cannot be resolved"
      + "\nname cannot be resolved"
      + "\nname cannot be resolved"
      + "\nunderscore cannot be resolved"
      + "\ntoUpperCase cannot be resolved"
      + "\nname cannot be resolved"
      + "\nname cannot be resolved"
      + "\nunderscore cannot be resolved"
      + "\ntoUpperCase cannot be resolved"
      + "\nname cannot be resolved"
      + "\nname cannot be resolved"
      + "\npascalize cannot be resolved"
      + "\nname cannot be resolved"
      + "\npascalize cannot be resolved"
      + "\nname cannot be resolved"
      + "\npascalize cannot be resolved");
  }
  
  public CharSequence generateStub(final MickeyDatabaseModel model, final SqliteDatabaseSnapshot snapshot) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("/*");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("* Generated by Mickey DB");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("*/");
    _builder.newLine();
    _builder.append("package ");
    String _packageName = model.getPackageName();
    _builder.append(_packageName, "");
    _builder.append(";");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("import android.content.Context;");
    _builder.newLine();
    _builder.append("import ");
    String _packageName_1 = model.getPackageName();
    _builder.append(_packageName_1, "");
    _builder.append(".Abstract");
    String _databaseName = model.getDatabaseName();
    String _pascalize = Strings.pascalize(_databaseName);
    _builder.append(_pascalize, "");
    _builder.append("OpenHelper;");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.newLine();
    _builder.append("public class ");
    String _databaseName_1 = model.getDatabaseName();
    String _pascalize_1 = Strings.pascalize(_databaseName_1);
    _builder.append(_pascalize_1, "");
    _builder.append("OpenHelper extends Abstract");
    String _databaseName_2 = model.getDatabaseName();
    String _pascalize_2 = Strings.pascalize(_databaseName_2);
    _builder.append(_pascalize_2, "");
    _builder.append("OpenHelper {");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("public ");
    String _databaseName_3 = model.getDatabaseName();
    String _pascalize_3 = Strings.pascalize(_databaseName_3);
    _builder.append(_pascalize_3, "\t");
    _builder.append("OpenHelper(Context context) {");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("super(context);");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    return _builder;
  }
}
