class Seatsio::SubaccountsClient

def activate(id:)

def activate(id:)
  @http_client.post("/subaccounts/#{id}/actions/activate")
end

def active

def active
  cursor status: 'active'
end

def copy_chart_to_parent(id: nil, chart_key: nil)

def copy_chart_to_parent(id: nil, chart_key: nil)
  response = @http_client.post("/subaccounts/#{id}/charts/#{chart_key}/actions/copy-to/parent")
  Domain::Chart.new(response)
end

def copy_chart_to_subaccount(from_id: nil, to_id: nil, chart_key: nil)

def copy_chart_to_subaccount(from_id: nil, to_id: nil, chart_key: nil)
  response = @http_client.post("/subaccounts/#{from_id}/charts/#{chart_key}/actions/copy-to/#{to_id}")
  Domain::Chart.new(response)
end

def create(name: nil, email: nil)

def create(name: nil, email: nil)
  body = {}
  body['name'] = name if name
  body['email'] = email if email
  response = @http_client.post("subaccounts", body)
  Domain::Subaccount.new(response)
end

def create_with_email(email: nil, name: nil)

def create_with_email(email: nil, name: nil)
  do_create name: name, email: email
end

def cursor(status: nil)

def cursor(status: nil)
  endpoint = status ? "subaccounts/#{status}" : 'subaccounts'
  Pagination::Cursor.new(Domain::Subaccount, endpoint, @http_client)
end

def deactivate(id:)

def deactivate(id:)
  @http_client.post("/subaccounts/#{id}/actions/deactivate")
end

def do_create(name: nil, email: nil)

def do_create(name: nil, email: nil)
  body = {}
  body['name'] = name if name
  body['email'] = email if email
  response = @http_client.post('subaccounts', body)
  Domain::Subaccount.new(response)
end

def inactive

def inactive
  cursor status: 'inactive'
end

def initialize(secret_key, workspace_key, base_url)

def initialize(secret_key, workspace_key, base_url)
  @http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url)
end

def list(filter: nil)

def list(filter: nil)
  extended_cursor = cursor
  extended_cursor.set_query_param('filter', filter)
  extended_cursor
end

def regenerate_designer_key(id:)

def regenerate_designer_key(id:)
  @http_client.post("/subaccounts/#{id}/designer-key/actions/regenerate")
end

def regenerate_secret_key(id:)

def regenerate_secret_key(id:)
  @http_client.post("/subaccounts/#{id}/secret-key/actions/regenerate")
end

def retrieve(id:)

def retrieve(id:)
  response = @http_client.get("/subaccounts/#{id}")
  Domain::Subaccount.new(response)
end

def update(id:, name: nil, email: nil)

def update(id:, name: nil, email: nil)
  body = {}
  body['name'] = name if name
  body['email'] = email if email
  @http_client.post("subaccounts/#{id}", body)
end