<commit_before>package lila.team

import org.joda.time.DateTime
import scala.util.chaining._

import lila.user.User

case class Team(
    _id: Team.ID, // also the url slug
    name: String,
    location: Option[String],
    password: Option[String],
    description: String,
    nbMembers: Int,
    enabled: Boolean,
    open: Boolean,
    createdAt: DateTime,
    createdBy: User.ID,
    leaders: Set[User.ID],
    chat: Team.ChatFor
) {

  def id = _id

  def slug = id

  def disabled = !enabled

  def isChatFor(f: Team.ChatFor.type => Team.ChatFor) =
    chat == f(Team.ChatFor)
}

object Team {

  val maxJoin = 100

  type ID = String

  type ChatFor = Int
  object ChatFor {
    val NONE    = 0
    val LEADERS = 10
    val MEMBERS = 20
    val all     = List(NONE, LEADERS, MEMBERS)
  }

  case class IdsStr(value: String) extends AnyVal {

    import IdsStr.separator

    def contains(teamId: ID) =
      value == teamId ||
        value.startsWith(s"$teamId$separator") ||
        value.endsWith(s"$separator$teamId") ||
        value.contains(s"$separator$teamId$separator")

    def toArray: Array[String] = value split IdsStr.separator
    def toList                 = value.nonEmpty ?? toArray.toList
  }

  object IdsStr {

    private val separator = ' '
<commit_msg>allow joining up to 32 teams<commit_after>package lila.team

import org.joda.time.DateTime
import scala.util.chaining._

import lila.user.User

case class Team(
    _id: Team.ID, // also the url slug
    name: String,
    location: Option[String],
    password: Option[String],
    description: String,
    nbMembers: Int,
    enabled: Boolean,
    open: Boolean,
    createdAt: DateTime,
    createdBy: User.ID,
    leaders: Set[User.ID],
    chat: Team.ChatFor
) {

  def id = _id

  def slug = id

  def disabled = !enabled

  def isChatFor(f: Team.ChatFor.type => Team.ChatFor) =
    chat == f(Team.ChatFor)
}

object Team {

  val maxJoin = 32

  type ID = String

  type ChatFor = Int
  object ChatFor {
    val NONE    = 0
    val LEADERS = 10
    val MEMBERS = 20
    val all     = List(NONE, LEADERS, MEMBERS)
  }

  case class IdsStr(value: String) extends AnyVal {

    import IdsStr.separator

    def contains(teamId: ID) =
      value == teamId ||
        value.startsWith(s"$teamId$separator") ||
        value.endsWith(s"$separator$teamId") ||
        value.contains(s"$separator$teamId$separator")

    def toArray: Array[String] = value split IdsStr.separator
    def toList                 = value.nonEmpty ?? toArray.toList
  }

  object IdsStr {

    private val separator = ' '

{'fraction_non_alphanumeric': 0.10595514307811292, 'fraction_numerical': 0.006573859242072699, 'mean_word_length': 2.623249299719888, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4647162', 'n_tokens_mistral': 913, 'n_tokens_neox': 853, 'n_words': 229}