|
| 1 | +package uk.gov.justice.digital.hmpps.organisationsapi.model.request.sync |
| 2 | + |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema |
| 4 | +import jakarta.validation.constraints.NotNull |
| 5 | +import jakarta.validation.constraints.Size |
| 6 | +import java.time.LocalDate |
| 7 | +import java.time.LocalDateTime |
| 8 | + |
| 9 | +/** |
| 10 | + The difference between a SyncCreateOrganisation and a CreateOrganisationRequest is only |
| 11 | + that the sync version accepts an Organisation ID field and has less stringent validation, so |
| 12 | + it accepts more of the range of values that the sync service provides from NOMIS. |
| 13 | +
|
| 14 | + The standard CreateOrganisationRequest is used in CRUD endpoints intended for use by the DPS |
| 15 | + UI service (and other DPS clients) and does not specify an organisation ID because this will be |
| 16 | + generated from a DPS range, and also has a higher standard of validation to ensure it captures |
| 17 | + more accurate values. |
| 18 | + */ |
| 19 | +@Schema(description = "Request to create a new organisation") |
| 20 | +data class SyncCreateOrganisationRequest( |
| 21 | + |
| 22 | + @Schema(description = "The organisation ID AKA the corporate ID from NOMIS", example = "1233323") |
| 23 | + @field:NotNull(message = "The organisation ID must be present in this request") |
| 24 | + val organisationId: Long, |
| 25 | + |
| 26 | + @Schema(description = "The name of the organisation", example = "Example Limited", maxLength = 40) |
| 27 | + @field:Size(max = 40, message = "organisationName must be <= 40 characters") |
| 28 | + val organisationName: String, |
| 29 | + |
| 30 | + @Schema( |
| 31 | + description = "The programme number for the organisation, stored as FEI_NUMBER in NOMIS", |
| 32 | + example = "1", |
| 33 | + maxLength = 40, |
| 34 | + nullable = true, |
| 35 | + ) |
| 36 | + @field:Size(max = 40, message = "programmeNumber must be <= 40 characters") |
| 37 | + val programmeNumber: String? = null, |
| 38 | + |
| 39 | + @Schema(description = "The VAT number for the organisation, if known", example = "123456", maxLength = 12, nullable = true) |
| 40 | + @field:Size(max = 12, message = "vatNumber must be <= 12 characters") |
| 41 | + val vatNumber: String? = null, |
| 42 | + |
| 43 | + @Schema( |
| 44 | + description = "The id of the caseload for this organisation, this is an agency id in NOMIS", |
| 45 | + example = "BXI", |
| 46 | + maxLength = 6, |
| 47 | + nullable = true, |
| 48 | + ) |
| 49 | + @field:Size(max = 6, message = "caseloadId must be <= 6 characters") |
| 50 | + val caseloadId: String? = null, |
| 51 | + |
| 52 | + @Schema(description = "Any comments on the organisation", example = "Some additional info", maxLength = 240, nullable = true) |
| 53 | + @field:Size(max = 240, message = "comments must be <= 240 characters") |
| 54 | + val comments: String? = null, |
| 55 | + |
| 56 | + @Schema(description = "Whether the organisation is active or not", example = "true") |
| 57 | + val active: Boolean = false, |
| 58 | + |
| 59 | + @Schema(description = "The date the organisation was deactivated, EXPIRY_DATE in NOMIS", example = "2010-12-30", nullable = true) |
| 60 | + val deactivatedDate: LocalDate? = null, |
| 61 | + |
| 62 | + @Schema(description = "User who created the entry", example = "admin") |
| 63 | + val createdBy: String, |
| 64 | + |
| 65 | + @Schema(description = "Timestamp when the entry was created", example = "2023-09-23T10:15:30") |
| 66 | + val createdTime: LocalDateTime, |
| 67 | + |
| 68 | + @Schema(description = "User who updated the entry", example = "admin2") |
| 69 | + val updatedBy: String? = null, |
| 70 | + |
| 71 | + @Schema(description = "Timestamp when the entry was updated", example = "2023-09-24T12:00:00") |
| 72 | + val updatedTime: LocalDateTime? = null, |
| 73 | +) |
0 commit comments