<commit_before>package org.orbeon.oxf.util

import org.orbeon.datatypes.{Mediatype, MediatypeRange}

sealed trait Reason
object Reason {
  case class SizeReason     (permitted: Long,                actual: Long)              extends Reason
  case class MediatypeReason(permitted: Set[MediatypeRange], actual: Option[Mediatype]) extends Reason
  case class FileScanReason (fieldName: String, message: Option[String])                extends Reason
}

sealed trait UploadState[+FileItemType] { def name: String }
object UploadState {
  case object Started                                         extends UploadState[Nothing]      { val name = "started" }
  case class  Completed[FileItemType](fileItem: FileItemType) extends UploadState[FileItemType] { val name = "completed" }
  case class  Interrupted(reason: Option[Reason])             extends UploadState[Nothing]      { val name = "interrupted" }
}

// NOTE: Fields don't need to be @volatile as they are accessed via the session, which provides synchronized access.
case class UploadProgress[FileItemType](
  fieldName        : String,
  expectedSize     : Option[Long],
  var receivedSize : Long        = 0L,
  var state        : UploadState[FileItemType] = UploadState.Started
)<commit_msg>Minor: indent<commit_after>package org.orbeon.oxf.util

import org.orbeon.datatypes.{Mediatype, MediatypeRange}

sealed trait Reason
object Reason {
  case class SizeReason     (permitted: Long,                actual: Long)              extends Reason
  case class MediatypeReason(permitted: Set[MediatypeRange], actual: Option[Mediatype]) extends Reason
  case class FileScanReason (fieldName: String, message: Option[String])                extends Reason
}

sealed trait UploadState[+FileItemType] { def name: String }
object UploadState {
  case object Started                                         extends UploadState[Nothing]      { val name = "started" }
  case class  Completed[FileItemType](fileItem: FileItemType) extends UploadState[FileItemType] { val name = "completed" }
  case class  Interrupted(reason: Option[Reason])             extends UploadState[Nothing]      { val name = "interrupted" }
}

// NOTE: Fields don't need to be @volatile as they are accessed via the session, which provides synchronized access.
case class UploadProgress[FileItemType](
  fieldName        : String,
  expectedSize     : Option[Long],
  var receivedSize : Long                      = 0L,
  var state        : UploadState[FileItemType] = UploadState.Started
)
{'fraction_non_alphanumeric': 0.07940941739824421, 'fraction_numerical': 0.0007980845969672786, 'mean_word_length': 3.136963696369637, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1696415', 'n_tokens_mistral': 699, 'n_tokens_neox': 678, 'n_words': 207}