def categoryUsageRightsProperties()

in metadata-editor/app/model/UsageRightsProperty.scala [79:148]


  def categoryUsageRightsProperties(u: UsageRightsSpec, p: UsageRightsConfigProvider) = u match {
    case Agency => List(
      requiredStringField("supplier", "Supplier", Some(sortList(p.freeSuppliers))),
      UsageRightsProperty(
        "suppliersCollection", "Collection", "string", required = false,
        examples = Some("News"))
    )

    case CommissionedAgency => List(requiredStringField("supplier", "Supplier", examples = Some("Corbis")))

    case StaffPhotographer => List(
      publicationField(required = true, optionsFromPublicationList(p.staffPhotographers)),
      photographerField(sortPublicationList(p.staffPhotographers), "publication")
    )

    case ContractPhotographer => List(
      publicationField(required = true, optionsFromPublicationList(p.contractedPhotographers)),
      photographerField(sortPublicationList(p.contractedPhotographers), "publication")
    )

    case CommissionedPhotographer => List(
      publicationField(required = false, optionsFromPublicationList(p.staffPhotographers)),
      photographerField("Sophia Evans, Murdo MacLeod")
    )

    case ContractIllustrator => List(
      publicationField(required = true, optionsFromPublicationList(p.contractIllustrators)),
      illustratorField(sortPublicationList(p.contractIllustrators), "publication")
    )

    case StaffIllustrator =>
      val options = if (p.staffIllustrators.isEmpty) None else Some(sortList(p.staffIllustrators))
      List(
      requiredStringField("creator", "Illustrator", options))

    case CommissionedIllustrator => List(
      publicationField(required = false, optionsFromPublicationList(p.staffPhotographers)),
      requiredStringField("creator", "Illustrator", examples = Some("Ellie Foreman Peck, Matt Bors")))

    case CreativeCommons => List(
      requiredStringField("licence", "Licence", Some(p.creativeCommonsLicense)),
      requiredStringField("source", "Source", examples = Some("Wikimedia Commons")),
      requiredStringField("creator", "Owner", examples = Some("User:Colin")),
      requiredStringField("contentLink", "Link to content", examples = Some("https://commons.wikimedia.org/wiki/File:Foreign_and_Commonwealth_Office_-_Durbar_Court.jpg"))
    )

    case Composite => List(
      requiredStringField("suppliers", "Suppliers", examples = Some("REX/Getty Images/Corbis, Corbis/Reuters"))
    )

    case Screengrab => List(
      requiredStringField("source", "Source", examples = Some("BBC News, HBO, ITV"))
    )

    case ProgrammesIndependents =>
      val independentTypeMap = p.programmesIndependentsConfig match {
        case Some(config) => independentTypeListToMap(config.independentTypes)
        case None => Map.empty[String, List[String]]
      }
      List(
        UsageRightsProperty("independentType", "Independent Type", "string", required = true, Some(sortList(independentTypeMap.keys.toList))),
        requiredStringField("productionCompany", "Production Company", optionsMap = Some(independentTypeMap), optionsMapKey = Some("independentType"))
      )

    case ProgrammesAcquisitions => List(
      requiredStringField("productionCompany", "Production Company", examples = Some("Example production"))
    )

    case _ => List()
  }