package main

import (
	"fmt"
)

type AirbusTeam struct {
	ID      int64        `json:"id"`
	Members []TeamMember `json:"members"`
	Name    string       `json:"name"`
}

type TeamMember struct {
	ID       int64  `json:"id"`
	Name     string `json:"name"`
	Nickname string `json:"nickname"`
	EMail    string `json:"email"`
}

type airbusDataTeam struct {
	Data []AirbusTeam `json:"data"`
}

func (a *AirbusAPI) GetTeams() ([]AirbusTeam, error) {
	var data airbusDataTeam
	err := a.request("GET", fmt.Sprintf("/v1/sessions/%d/teams", a.SessionID), nil, &data)
	if err != nil {
		return nil, err
	} else {
		return data.Data, nil
	}
}
