import { BaseGroupingRenderer, IGroupingRendererConfig } from '../../core/BaseGroupingRenderer';
import { TeamService } from '../../storage/teams/TeamService';
import { ITeam } from '../../types/CalendarTypes';

export class TeamRenderer extends BaseGroupingRenderer<ITeam> {
  readonly type = 'team';

  protected readonly config: IGroupingRendererConfig = {
    elementTag: 'swp-team-header',
    idAttribute: 'teamId',
    colspanVar: '--team-cols'
  };

  constructor(private teamService: TeamService) {
    super();
  }

  protected getEntities(ids: string[]): Promise<ITeam[]> {
    return this.teamService.getByIds(ids);
  }

  protected getDisplayName(entity: ITeam): string {
    return entity.name;
  }
}
