 
 ProviderInterface = require './providerinterface'
 KodingError       = require '../../error'
+Payment           = require '../payment'
 
 {argv}            = require 'optimist'
 KONFIG            = require('koding-config-manager').load("main.#{argv.c}")

    { r: { group, user, account } } = client

    storage ?= 3
    userPlan = getUserPlan account

    @fetchUsage client, options, (err, usage)->

      return callback err  if err?

      if err = checkUsage usage, userPlan, storage
        return callback err

      guessNextLabel user, group, label, (err, label)->

        meta =
          type          : "amazon"
          region        : "us-east-1"
          source_ami    : "ami-2651904e"
          instance_type : "t2.micro"
          storage_size  : storage
          alwaysOn      : no

        callback null, {
          meta, label, credential: client.r.user.username
        }


  @update = (client, options, callback)->

    callback null, "Koding is the best #{ client.r.account.profile.nickname }!"


  @fetchUserPlan = (client, callback)->

    Payment.subscriptions client, {}, (err, subscription)=>

      if err? or not subscription?
      then plan = 'free'
      else plan = subscription.planTitle

      callback err, PLANS[plan]


  checkUsage = (usage, plan, storage)->
