import type { TOCPosition } from "@shared/types";
import { TeamPreference } from "@shared/types";
import type { Team } from "@server/models";

export default function presentPublicTeam(
  /** The team to present */
  team: Team,
  /** Whether the branding is public */
  isBrandingPublic: boolean
) {
  return {
    ...(isBrandingPublic
      ? {
          name: team.name,
          avatarUrl: team.avatarUrl,
          customTheme: team.getPreference(TeamPreference.CustomTheme),
        }
      : {}),
    tocPosition: team.getPreference(TeamPreference.TocPosition) as TOCPosition,
  };
}
