import EmberError from "@ember/error";
import { dasherize } from "@ember/string";
import { pluralize } from "ember-inflector";
import JSONAPIAdapter from "ember-data/adapters/json-api";
import { assign } from "@ember/polyfills";

export default JSONAPIAdapter.extend({
  coalesceFindRequests: true,

  host: "",
  modelWhitelist: [
    "basket",
    "basket-item",
    "category",
    "country",
    "order",
    "order-line",
    "order-payment-method",
    "payment",
    "payment-method",
    "price",
    "product-category",
    "product-image",
    "product",
    "promotion",
    "shop-payment-method",
    "state",
    "sku-image",
    "sku"
  ],

  pathForType(type) {
    if (this.modelWhitelist.includes(type)) {
      return this._super(...arguments);
    }
    return "entries";
  },

  /**
   @override
   */
  findAll(store, type, sinceToken) {
    let modelName = type.modelName;

    if (this.modelWhitelist.includes(type.modelName)) {
      return this._super(...arguments);
    }

    let query = {
      content_group_api_identifier: pluralize(dasherize(modelName))
    };

    const url = this.buildURL(modelName, null, null, "findAll");

    if (sinceToken) {
      query.since = sinceToken;
    }

    if (this.sortQueryParams) {
      query = this.sortQueryParams(query);
    }
    return this.ajax(url, "GET", { data: { filter: query } });
  },

  // /**
  //  @override
  //  */
  query(store, type, query) {
    let modelName = type.modelName;

    if (this.modelWhitelist.includes(type.modelName)) {
      return this._super(...arguments);
    }

    query.filter = assign({}, query.filter, {
      content_group_api_identifier: pluralize(dasherize(modelName))
    });

    if (this.sortQueryParams) {
      query = this.sortQueryParams(query);
    }

    let url = this.buildURL(modelName, null, null, "query", query);

    return this.ajax(url, "GET", { data: query });
  },

  /**
   @override
   * */
  queryRecord() {
    throw new EmberError(
      "You may not call 'queryRecord' on a store. Use 'query'."
    );
  },
  /**
   @override
   */
  findMany(store, type) {
    if (this.modelWhitelist.includes(type.modelName)) {
      return this._super(...arguments);
    }
    return null;
  },

  /**
   @override
   */
  findHasMany(store, type) {
    if (this.modelWhitelist.includes(type.modelName)) {
      return this._super(...arguments);
    }
    return null;
  },

  /**
   @override
   */
  findBelongsTo(store, type) {
    if (this.modelWhitelist.includes(type.modelName)) {
      return this._super(...arguments);
    }
    return null;
  },

  /**
   @override
   */
  updateRecord(store, type) {
    if (this.modelWhitelist.includes(type.modelName)) {
      return this._super(...arguments);
    }
    throw new EmberError("You may not call 'updateRecord' on a content entry.");
  },

  /**
   @override
   * */
  deleteRecord(store, type) {
    if (this.modelWhitelist.includes(type.modelName)) {
      return this._super(...arguments);
    }
    throw new EmberError("You may not call 'deleteRecord' on a content entry.");
  }
});

@@ -1,131 +1,4 @@
-import EmberError from %22@ember/error%22;%0Aimport %7B dasherize %7D from %22@ember/string%22;%0Aimport %7B pluralize %7D from %22ember-inflector%22;%0A
 impo
@@ -55,51 +55,8 @@
 pi%22;
-%0Aimport %7B assign %7D from %22@ember/polyfills%22;
 %0A%0Aex
@@ -127,20 +127,8 @@
 e,%0A%0A
-  host: %22%22,%0A
   mo
@@ -584,2308 +584,57 @@
   %7D%0A
-    return %22entries%22;%0A  %7D,%0A%0A  /**%0A   @override%0A   */%0A  findAll(store, type, sinceToken) %7B%0A    let modelName = type.modelName;%0A%0A    if (this.modelWhitelist.includes(type.modelName)) %7B%0A      return this._super(...arguments);%0A    %7D%0A%0A    let query = %7B%0A      content_group_api_identifier: pluralize(dasherize(modelName))%0A    %7D;%0A%0A    const url = this.buildURL(modelName, null, null, %22findAll%22);%0A%0A    if (sinceToken) %7B%0A      query.since = sinceToken;%0A    %7D%0A%0A    if (this.sortQueryParams) %7B%0A      query = this.sortQueryParams(query);%0A    %7D%0A    return this.ajax(url, %22GET%22, %7B data: %7B filter: query %7D %7D);%0A  %7D,%0A%0A  // /**%0A  //  @override%0A  //  */%0A  query(store, type, query) %7B%0A    let modelName = type.modelName;%0A%0A    if (this.modelWhitelist.includes(type.modelName)) %7B%0A      return this._super(...arguments);%0A    %7D%0A%0A    query.filter = assign(%7B%7D, query.filter, %7B%0A      content_group_api_identifier: pluralize(dasherize(modelName))%0A    %7D);%0A%0A    if (this.sortQueryParams) %7B%0A      query = this.sortQueryParams(query);%0A    %7D%0A%0A    let url = this.buildURL(modelName, null, null, %22query%22, query);%0A%0A    return this.ajax(url, %22GET%22, %7B data: query %7D);%0A  %7D,%0A%0A  /**%0A   @override%0A   * */%0A  queryRecord() %7B%0A    throw new EmberError(%0A      %22You may not call 'queryRecord' on a store. Use 'query'.%22%0A    );%0A  %7D,%0A  /**%0A   @override%0A   */%0A  findMany(store, type) %7B%0A    if (this.modelWhitelist.includes(type.modelName)) %7B%0A      return this._super(...arguments);%0A    %7D%0A    return null;%0A  %7D,%0A%0A  /**%0A   @override%0A   */%0A  findHasMany(store, type) %7B%0A    if (this.modelWhitelist.includes(type.modelName)) %7B%0A      return this._super(...arguments);%0A    %7D%0A    return null;%0A  %7D,%0A%0A  /**%0A   @override%0A   */%0A  findBelongsTo(store, type) %7B%0A    if (this.modelWhitelist.includes(type.modelName)) %7B%0A      return this._super(...arguments);%0A    %7D%0A    return null;%0A  %7D,%0A%0A  /**%0A   @override%0A   */%0A  updateRecord(store, type) %7B%0A    if (this.modelWhitelist.includes(type.modelName)) %7B%0A      return this._super(...arguments);%0A    %7D%0A    throw new EmberError(%22You may not call 'updateRecord' on a content entry.%22);%0A  %7D,%0A%0A  /**%0A   @override%0A   * */%0A  deleteRecord(store, type) %7B%0A    if (this.modelWhitelist.includes(type.modelName)) %7B%0A      return this._super(...arguments);%0A    %7D%0A    throw new EmberError(%22You may not call 'deleteRecord' on a content entry.%22
+%0A    return %22content/%22 + this._super(...arguments
 );%0A 

Use /content/ in adapter pathForType