import ManagementModel from './management-model';
import Attributes from './attributes';

export default class ManagementAccount extends ManagementModel {
  upgrade() {
    return this.connection
      .request({
        method: 'POST',
        path: `/a/${this.clientId}/${this.constructor.collectionName}/${this.id}/upgrade`,
      })
      .catch(err => Promise.reject(err));
  }

  downgrade() {
    return this.connection
      .request({
        method: 'POST',
        path: `/a/${this.clientId}/${this.constructor.collectionName}/${this.id}/downgrade`,
      })
      .catch(err => Promise.reject(err));
  }

  revokeAll(keep_access_token) {
    return this.connection
      .request({
        method: 'POST',
        path: `/a/${this.clientId}/${this.constructor.collectionName}/${this.id}/revoke-all`,
        body: { keep_access_token: keep_access_token },
      })
      .catch(err => Promise.reject(err));
  }
  ipAddresses() {
    return this.connection
      .request({
        method: 'GET',
        path: `/a/${this.clientId}/ip_addresses`,
      })
      .catch(err => Promise.reject(err));
  }
  tokenInfo(access_token) {
    return this.connection
      .request({
        method: 'POST',
        path: `/a/${this.appId}/${this.constructor.collectionName}/${this.id}/token-info`,
        body: { 
          access_token: access_token
        },
      })
      .catch(err => Promise.reject(err));
  }
}
ManagementAccount.collectionName = 'accounts';
ManagementAccount.attributes = {
  ...ManagementModel.attributes,
  billingState: Attributes.String({
    modelKey: 'billingState',
    jsonKey: 'billing_state',
  }),
  emailAddress: Attributes.String({
    modelKey: 'emailAddress',
    jsonKey: 'email',
  }),
  namespaceId: Attributes.String({
    modelKey: 'namespaceId',
    jsonKey: 'namespace_id',
  }),
  provider: Attributes.String({
    modelKey: 'provider',
  }),
  syncState: Attributes.String({
    modelKey: 'syncState',
    jsonKey: 'sync_state',
  }),
  trial: Attributes.Boolean({
    modelKey: 'trial',
  }),
};

@@ -1308,17 +1308,16 @@
  body: %7B
- 
 %0A       
@@ -1345,16 +1345,17 @@
 ss_token
+,
 %0A       

fix lint errors