|
| 1 | +package ca.bc.gov.oracleapi.dto.consep; |
| 2 | + |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | +import org.springframework.format.annotation.DateTimeFormat; |
| 5 | + |
| 6 | +import java.time.LocalDate; |
| 7 | +import java.util.List; |
| 8 | + |
| 9 | +import jakarta.validation.constraints.Max; |
| 10 | +import jakarta.validation.constraints.Min; |
| 11 | +import jakarta.validation.constraints.Size; |
| 12 | +import jakarta.validation.constraints.Pattern; |
| 13 | + |
| 14 | + |
| 15 | +/** |
| 16 | + * This record serves the purpose of mapping fields the FE should send to the BE, to search a test activity. |
| 17 | + */ |
| 18 | +@Schema(description = "Search parameters for testing activity search API") |
| 19 | +public record ActivitySearchRequestDto( |
| 20 | + @Schema(description = "Seedlot and Family Lot numbers", example = "[\"12345\", \"67890\"]") |
| 21 | + @Size(max = 5, message = "You can provide up to 5 lot numbers") |
| 22 | + List<@Size(max = 5, message = "Each lot number must be at most 5 characters") String> lotNumbers, |
| 23 | + |
| 24 | + @Schema(description = "Test activity type code, used to filter activity_type_cd") |
| 25 | + @Size(max = 3) |
| 26 | + String testType, |
| 27 | + |
| 28 | + @Schema(description = "Activity ID, used to filter stndrd_activity_id") |
| 29 | + @Size(max = 3) |
| 30 | + String activityId, |
| 31 | + |
| 32 | + @Schema(description = "Germinator Tray ID, used to filter germinator_tray_id") |
| 33 | + @Max(value = 99999, message = "Germinator Tray ID must be at most 5 digits") |
| 34 | + @Min(value = 0) |
| 35 | + Integer germinatorTrayId, |
| 36 | + |
| 37 | + @Schema(description = "Withdrawal start date", example = "2025-07-01") |
| 38 | + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) |
| 39 | + LocalDate seedWithdrawalStartDate, |
| 40 | + |
| 41 | + @Schema(description = "Withdrawal End date", example = "2025-07-01") |
| 42 | + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) |
| 43 | + LocalDate seedWithdrawalEndDate, |
| 44 | + |
| 45 | + @Schema(description = "Include historical tests, used to filter request_skey") |
| 46 | + Boolean includeHistoricalTests, |
| 47 | + |
| 48 | + @Schema(description = "Germ tests only, used to filter germ_test_ind") |
| 49 | + Boolean germTestsOnly, |
| 50 | + |
| 51 | + @Schema(description = "Request ID, used to filter req_id (first 11 char) and item_id (the 12th char)") |
| 52 | + @Size(max = 12) |
| 53 | + String requestId, |
| 54 | + |
| 55 | + @Schema(description = "Request type, used to filter request_type_st") |
| 56 | + @Size(max = 3) |
| 57 | + String requestType, |
| 58 | + |
| 59 | + @Schema(description = "Request year between 1900 and 9999, used to filter request_yr") |
| 60 | + @Min(value = 1900) |
| 61 | + @Max(value = 9999) |
| 62 | + Integer requestYear, |
| 63 | + |
| 64 | + @Schema(description = "Orchard ID, used to filter orchard_id") |
| 65 | + @Size(max = 3) |
| 66 | + String orchardId, |
| 67 | + |
| 68 | + @Schema(description = "Category, used to filter test_category_cd") |
| 69 | + @Size(max = 3) |
| 70 | + String testCategoryCd, |
| 71 | + |
| 72 | + @Schema(description = "Rank, used to filter test_rank") |
| 73 | + @Size(max = 1) |
| 74 | + String testRank, |
| 75 | + |
| 76 | + @Schema(description = "Species, used to filter vegetation_st") |
| 77 | + @Size(max = 8) |
| 78 | + String species, |
| 79 | + |
| 80 | + @Schema(description = "Actual begin date from", example = "2025-01-01") |
| 81 | + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) |
| 82 | + LocalDate actualBeginDateFrom, |
| 83 | + |
| 84 | + @Schema(description = "Actual begin date to", example = "2025-01-31") |
| 85 | + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) |
| 86 | + LocalDate actualBeginDateTo, |
| 87 | + |
| 88 | + @Schema(description = "Actual end date from", example = "2025-02-01") |
| 89 | + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) |
| 90 | + LocalDate actualEndDateFrom, |
| 91 | + |
| 92 | + @Schema(description = "Actual end date to", example = "2025-02-28") |
| 93 | + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) |
| 94 | + LocalDate actualEndDateTo, |
| 95 | + |
| 96 | + @Schema(description = "Revised begin date from", example = "2025-03-01") |
| 97 | + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) |
| 98 | + LocalDate revisedStartDateFrom, |
| 99 | + |
| 100 | + @Schema(description = "Revised begin date to", example = "2025-03-31") |
| 101 | + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) |
| 102 | + LocalDate revisedStartDateTo, |
| 103 | + |
| 104 | + @Schema(description = "Revised end date from", example = "2025-04-01") |
| 105 | + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) |
| 106 | + LocalDate revisedEndDateFrom, |
| 107 | + |
| 108 | + @Schema(description = "Revised end date to", example = "2025-04-30") |
| 109 | + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) |
| 110 | + LocalDate revisedEndDateTo, |
| 111 | + |
| 112 | + @Schema(description = "Germ tray assignment status: -1 = Assigned, 0 = Unassigned, used to filter assigned_tray_ind") |
| 113 | + @Min(-1) |
| 114 | + @Max(0) |
| 115 | + Integer germTrayAssignment, |
| 116 | + |
| 117 | + @Schema(description = "Test completion status: -1 = Complete, 0 = Incomplete, used to filter test_complete_ind") |
| 118 | + @Min(-1) |
| 119 | + @Max(0) |
| 120 | + Integer completeStatus, |
| 121 | + |
| 122 | + @Schema(description = "Acceptance status: -1 = Accepted, 0 = Unaccepted, used to filter accept_result_ind") |
| 123 | + @Min(-1) |
| 124 | + @Max(0) |
| 125 | + Integer acceptanceStatus, |
| 126 | + |
| 127 | + @Schema(description = "Genetic class code: A = A Class, B = B Class", allowableValues = {"A", "B"}) |
| 128 | + @Pattern(regexp = "[AB]", message = "geneticClassCode must be 'A' or 'B'") |
| 129 | + String seedlotClass |
| 130 | +) { |
| 131 | +} |
0 commit comments