diff --git a/connectionpetstore.properties b/connectionpetstore.properties
index 426ecafb..00ffda7d 100644
--- a/connectionpetstore.properties
+++ b/connectionpetstore.properties
@@ -1,3 +1,4 @@
url=jdbc:mysql://127.0.0.1:3306/Petstoredb?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
user=petapp
-password=petapppass
\ No newline at end of file
+password=petapppass
+api.baseUrl=http://localhost:8080
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 3c683c9e..437e7605 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,6 +44,27 @@
mysql-connector-j
9.3.0
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.18.2
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-jsr310
+ 2.18.2
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ 2.18.2
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+ 2.18.2
+
diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java
index d1f07dd9..d946c327 100644
--- a/src/main/java/module-info.java
+++ b/src/main/java/module-info.java
@@ -2,6 +2,11 @@ module org.example.petshopdesktop {
requires javafx.controls;
requires javafx.fxml;
requires java.sql;
+ requires java.net.http;
+ requires com.fasterxml.jackson.databind;
+ requires com.fasterxml.jackson.core;
+ requires com.fasterxml.jackson.annotation;
+ requires com.fasterxml.jackson.datatype.jsr310;
opens org.example.petshopdesktop.DTOs to javafx.base;
opens org.example.petshopdesktop.models to javafx.base;
@@ -10,6 +15,21 @@ module org.example.petshopdesktop {
opens org.example.petshopdesktop.controllers to javafx.fxml;
opens org.example.petshopdesktop.auth to javafx.fxml;
+ opens org.example.petshopdesktop.api.dto.common to com.fasterxml.jackson.databind;
+ opens org.example.petshopdesktop.api.dto.auth to com.fasterxml.jackson.databind;
+ opens org.example.petshopdesktop.api.dto.product to com.fasterxml.jackson.databind;
+ opens org.example.petshopdesktop.api.dto.pet to com.fasterxml.jackson.databind;
+ opens org.example.petshopdesktop.api.dto.service to com.fasterxml.jackson.databind;
+ opens org.example.petshopdesktop.api.dto.supplier to com.fasterxml.jackson.databind;
+ opens org.example.petshopdesktop.api.dto.productsupplier to com.fasterxml.jackson.databind;
+ opens org.example.petshopdesktop.api.dto.inventory to com.fasterxml.jackson.databind;
+ opens org.example.petshopdesktop.api.dto.appointment to com.fasterxml.jackson.databind;
+ opens org.example.petshopdesktop.api.dto.adoption to com.fasterxml.jackson.databind;
+ opens org.example.petshopdesktop.api.dto.sale to com.fasterxml.jackson.databind;
+ opens org.example.petshopdesktop.api.dto.user to com.fasterxml.jackson.databind;
+ opens org.example.petshopdesktop.api.dto.analytics to com.fasterxml.jackson.databind;
+ opens org.example.petshopdesktop.api.dto.purchaseorder to com.fasterxml.jackson.databind;
+
exports org.example.petshopdesktop;
exports org.example.petshopdesktop.controllers;
exports org.example.petshopdesktop.auth;
diff --git a/src/main/java/org/example/petshopdesktop/api/ApiClient.java b/src/main/java/org/example/petshopdesktop/api/ApiClient.java
new file mode 100644
index 00000000..e8f5a2b4
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/ApiClient.java
@@ -0,0 +1,164 @@
+package org.example.petshopdesktop.api;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import org.example.petshopdesktop.auth.UserSession;
+
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.time.Duration;
+
+public class ApiClient {
+ private static final ApiClient INSTANCE = new ApiClient();
+ private final HttpClient httpClient;
+ private final ObjectMapper objectMapper;
+ private final String baseUrl;
+
+ private ApiClient() {
+ this.httpClient = HttpClient.newBuilder()
+ .connectTimeout(Duration.ofSeconds(10))
+ .build();
+ this.objectMapper = new ObjectMapper();
+ this.objectMapper.registerModule(new JavaTimeModule());
+ this.baseUrl = ApiConfig.getInstance().getBaseUrl();
+ }
+
+ public static ApiClient getInstance() {
+ return INSTANCE;
+ }
+
+ public T get(String path, Class responseClass) throws Exception {
+ HttpRequest.Builder builder = HttpRequest.newBuilder()
+ .uri(URI.create(baseUrl + path))
+ .GET()
+ .timeout(Duration.ofSeconds(30));
+
+ addAuthHeader(builder);
+
+ HttpRequest request = builder.build();
+ HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
+
+ return handleResponse(response, responseClass);
+ }
+
+ public T post(String path, Object requestBody, Class responseClass) throws Exception {
+ String jsonBody = objectMapper.writeValueAsString(requestBody);
+
+ HttpRequest.Builder builder = HttpRequest.newBuilder()
+ .uri(URI.create(baseUrl + path))
+ .header("Content-Type", "application/json")
+ .POST(HttpRequest.BodyPublishers.ofString(jsonBody))
+ .timeout(Duration.ofSeconds(30));
+
+ addAuthHeader(builder);
+
+ HttpRequest request = builder.build();
+ HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
+
+ return handleResponse(response, responseClass);
+ }
+
+ public T put(String path, Object requestBody, Class responseClass) throws Exception {
+ String jsonBody = objectMapper.writeValueAsString(requestBody);
+
+ HttpRequest.Builder builder = HttpRequest.newBuilder()
+ .uri(URI.create(baseUrl + path))
+ .header("Content-Type", "application/json")
+ .PUT(HttpRequest.BodyPublishers.ofString(jsonBody))
+ .timeout(Duration.ofSeconds(30));
+
+ addAuthHeader(builder);
+
+ HttpRequest request = builder.build();
+ HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
+
+ return handleResponse(response, responseClass);
+ }
+
+ public void delete(String path) throws Exception {
+ HttpRequest.Builder builder = HttpRequest.newBuilder()
+ .uri(URI.create(baseUrl + path))
+ .DELETE()
+ .timeout(Duration.ofSeconds(30));
+
+ addAuthHeader(builder);
+
+ HttpRequest request = builder.build();
+ HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
+
+ if (response.statusCode() != 204 && response.statusCode() != 200) {
+ throw new RuntimeException(parseErrorMessage(response));
+ }
+ }
+
+ public void deleteWithBody(String path, Object requestBody) throws Exception {
+ String jsonBody = objectMapper.writeValueAsString(requestBody);
+
+ HttpRequest.Builder builder = HttpRequest.newBuilder()
+ .uri(URI.create(baseUrl + path))
+ .header("Content-Type", "application/json")
+ .method("DELETE", HttpRequest.BodyPublishers.ofString(jsonBody))
+ .timeout(Duration.ofSeconds(30));
+
+ addAuthHeader(builder);
+
+ HttpRequest request = builder.build();
+ HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
+
+ if (response.statusCode() != 204 && response.statusCode() != 200) {
+ throw new RuntimeException(parseErrorMessage(response));
+ }
+ }
+
+ private void addAuthHeader(HttpRequest.Builder builder) {
+ String token = UserSession.getInstance().getJwtToken();
+ if (token != null && !token.isEmpty()) {
+ builder.header("Authorization", "Bearer " + token);
+ }
+ }
+
+ private T handleResponse(HttpResponse response, Class responseClass) throws Exception {
+ int statusCode = response.statusCode();
+
+ if (statusCode == 200 || statusCode == 201) {
+ if (response.body() == null || response.body().isEmpty()) {
+ return null;
+ }
+ return objectMapper.readValue(response.body(), responseClass);
+ } else if (statusCode == 204) {
+ return null;
+ } else if (statusCode == 401) {
+ throw new RuntimeException("Authentication failed. Please log in again.");
+ } else if (statusCode == 403) {
+ throw new RuntimeException("Access restricted. You don't have permission to perform this action.");
+ } else {
+ throw new RuntimeException(parseErrorMessage(response));
+ }
+ }
+
+ private String parseErrorMessage(HttpResponse response) {
+ try {
+ if (response.body() != null && !response.body().isEmpty()) {
+ var errorNode = objectMapper.readTree(response.body());
+ if (errorNode.has("message")) {
+ return errorNode.get("message").asText();
+ }
+ if (errorNode.has("errors")) {
+ StringBuilder sb = new StringBuilder();
+ errorNode.get("errors").fields().forEachRemaining(entry -> {
+ sb.append(entry.getValue().asText()).append("\n");
+ });
+ return sb.toString().trim();
+ }
+ }
+ } catch (Exception e) {
+ }
+ return "Request failed with status " + response.statusCode();
+ }
+
+ public ObjectMapper getObjectMapper() {
+ return objectMapper;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/ApiConfig.java b/src/main/java/org/example/petshopdesktop/api/ApiConfig.java
new file mode 100644
index 00000000..3394c653
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/ApiConfig.java
@@ -0,0 +1,34 @@
+package org.example.petshopdesktop.api;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+public class ApiConfig {
+ private static final ApiConfig INSTANCE = new ApiConfig();
+ private final String baseUrl;
+
+ private ApiConfig() {
+ Properties props = new Properties();
+ String url = "http://localhost:8080";
+
+ try (InputStream input = getClass().getClassLoader().getResourceAsStream("connectionpetstore.properties")) {
+ if (input != null) {
+ props.load(input);
+ url = props.getProperty("api.baseUrl", "http://localhost:8080");
+ }
+ } catch (IOException e) {
+ System.err.println("Failed to load api.baseUrl from properties: " + e.getMessage());
+ }
+
+ this.baseUrl = url;
+ }
+
+ public static ApiConfig getInstance() {
+ return INSTANCE;
+ }
+
+ public String getBaseUrl() {
+ return baseUrl;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/adoption/AdoptionRequest.java b/src/main/java/org/example/petshopdesktop/api/dto/adoption/AdoptionRequest.java
new file mode 100644
index 00000000..230d5413
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/adoption/AdoptionRequest.java
@@ -0,0 +1,42 @@
+package org.example.petshopdesktop.api.dto.adoption;
+
+import java.time.LocalDate;
+
+public class AdoptionRequest {
+ private Long petId;
+ private Long customerId;
+ private LocalDate adoptionDate;
+ private String adoptionStatus;
+
+ public Long getPetId() {
+ return petId;
+ }
+
+ public void setPetId(Long petId) {
+ this.petId = petId;
+ }
+
+ public Long getCustomerId() {
+ return customerId;
+ }
+
+ public void setCustomerId(Long customerId) {
+ this.customerId = customerId;
+ }
+
+ public LocalDate getAdoptionDate() {
+ return adoptionDate;
+ }
+
+ public void setAdoptionDate(LocalDate adoptionDate) {
+ this.adoptionDate = adoptionDate;
+ }
+
+ public String getAdoptionStatus() {
+ return adoptionStatus;
+ }
+
+ public void setAdoptionStatus(String adoptionStatus) {
+ this.adoptionStatus = adoptionStatus;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/adoption/AdoptionResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/adoption/AdoptionResponse.java
new file mode 100644
index 00000000..2466a287
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/adoption/AdoptionResponse.java
@@ -0,0 +1,51 @@
+package org.example.petshopdesktop.api.dto.adoption;
+
+import java.time.LocalDate;
+
+public class AdoptionResponse {
+ private Long id;
+ private String petName;
+ private String customerName;
+ private LocalDate adoptionDate;
+ private String adoptionStatus;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getPetName() {
+ return petName;
+ }
+
+ public void setPetName(String petName) {
+ this.petName = petName;
+ }
+
+ public String getCustomerName() {
+ return customerName;
+ }
+
+ public void setCustomerName(String customerName) {
+ this.customerName = customerName;
+ }
+
+ public LocalDate getAdoptionDate() {
+ return adoptionDate;
+ }
+
+ public void setAdoptionDate(LocalDate adoptionDate) {
+ this.adoptionDate = adoptionDate;
+ }
+
+ public String getAdoptionStatus() {
+ return adoptionStatus;
+ }
+
+ public void setAdoptionStatus(String adoptionStatus) {
+ this.adoptionStatus = adoptionStatus;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/analytics/DailySales.java b/src/main/java/org/example/petshopdesktop/api/dto/analytics/DailySales.java
new file mode 100644
index 00000000..602fc8be
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/analytics/DailySales.java
@@ -0,0 +1,25 @@
+package org.example.petshopdesktop.api.dto.analytics;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+public class DailySales {
+ private LocalDate date;
+ private BigDecimal totalSales;
+
+ public LocalDate getDate() {
+ return date;
+ }
+
+ public void setDate(LocalDate date) {
+ this.date = date;
+ }
+
+ public BigDecimal getTotalSales() {
+ return totalSales;
+ }
+
+ public void setTotalSales(BigDecimal totalSales) {
+ this.totalSales = totalSales;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/analytics/DashboardResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/analytics/DashboardResponse.java
new file mode 100644
index 00000000..0618419b
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/analytics/DashboardResponse.java
@@ -0,0 +1,61 @@
+package org.example.petshopdesktop.api.dto.analytics;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+public class DashboardResponse {
+ private BigDecimal totalRevenue;
+ private Long totalSales;
+ private Long totalCustomers;
+ private Long totalProducts;
+ private List dailySales;
+ private List topProducts;
+
+ public BigDecimal getTotalRevenue() {
+ return totalRevenue;
+ }
+
+ public void setTotalRevenue(BigDecimal totalRevenue) {
+ this.totalRevenue = totalRevenue;
+ }
+
+ public Long getTotalSales() {
+ return totalSales;
+ }
+
+ public void setTotalSales(Long totalSales) {
+ this.totalSales = totalSales;
+ }
+
+ public Long getTotalCustomers() {
+ return totalCustomers;
+ }
+
+ public void setTotalCustomers(Long totalCustomers) {
+ this.totalCustomers = totalCustomers;
+ }
+
+ public Long getTotalProducts() {
+ return totalProducts;
+ }
+
+ public void setTotalProducts(Long totalProducts) {
+ this.totalProducts = totalProducts;
+ }
+
+ public List getDailySales() {
+ return dailySales;
+ }
+
+ public void setDailySales(List dailySales) {
+ this.dailySales = dailySales;
+ }
+
+ public List getTopProducts() {
+ return topProducts;
+ }
+
+ public void setTopProducts(List topProducts) {
+ this.topProducts = topProducts;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/analytics/TopProduct.java b/src/main/java/org/example/petshopdesktop/api/dto/analytics/TopProduct.java
new file mode 100644
index 00000000..bc63265a
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/analytics/TopProduct.java
@@ -0,0 +1,33 @@
+package org.example.petshopdesktop.api.dto.analytics;
+
+import java.math.BigDecimal;
+
+public class TopProduct {
+ private String productName;
+ private Integer quantitySold;
+ private BigDecimal totalRevenue;
+
+ public String getProductName() {
+ return productName;
+ }
+
+ public void setProductName(String productName) {
+ this.productName = productName;
+ }
+
+ public Integer getQuantitySold() {
+ return quantitySold;
+ }
+
+ public void setQuantitySold(Integer quantitySold) {
+ this.quantitySold = quantitySold;
+ }
+
+ public BigDecimal getTotalRevenue() {
+ return totalRevenue;
+ }
+
+ public void setTotalRevenue(BigDecimal totalRevenue) {
+ this.totalRevenue = totalRevenue;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/appointment/AppointmentRequest.java b/src/main/java/org/example/petshopdesktop/api/dto/appointment/AppointmentRequest.java
new file mode 100644
index 00000000..e675834c
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/appointment/AppointmentRequest.java
@@ -0,0 +1,62 @@
+package org.example.petshopdesktop.api.dto.appointment;
+
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.util.List;
+
+public class AppointmentRequest {
+ private List petIds;
+ private Long customerId;
+ private Long serviceId;
+ private LocalDate appointmentDate;
+ private LocalTime appointmentTime;
+ private String appointmentStatus;
+
+ public List getPetIds() {
+ return petIds;
+ }
+
+ public void setPetIds(List petIds) {
+ this.petIds = petIds;
+ }
+
+ public Long getCustomerId() {
+ return customerId;
+ }
+
+ public void setCustomerId(Long customerId) {
+ this.customerId = customerId;
+ }
+
+ public Long getServiceId() {
+ return serviceId;
+ }
+
+ public void setServiceId(Long serviceId) {
+ this.serviceId = serviceId;
+ }
+
+ public LocalDate getAppointmentDate() {
+ return appointmentDate;
+ }
+
+ public void setAppointmentDate(LocalDate appointmentDate) {
+ this.appointmentDate = appointmentDate;
+ }
+
+ public LocalTime getAppointmentTime() {
+ return appointmentTime;
+ }
+
+ public void setAppointmentTime(LocalTime appointmentTime) {
+ this.appointmentTime = appointmentTime;
+ }
+
+ public String getAppointmentStatus() {
+ return appointmentStatus;
+ }
+
+ public void setAppointmentStatus(String appointmentStatus) {
+ this.appointmentStatus = appointmentStatus;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/appointment/AppointmentResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/appointment/AppointmentResponse.java
new file mode 100644
index 00000000..bbe42bd1
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/appointment/AppointmentResponse.java
@@ -0,0 +1,70 @@
+package org.example.petshopdesktop.api.dto.appointment;
+
+import java.time.LocalDate;
+import java.time.LocalTime;
+
+public class AppointmentResponse {
+ private Long id;
+ private String customerName;
+ private String petNames;
+ private String serviceName;
+ private LocalDate appointmentDate;
+ private LocalTime appointmentTime;
+ private String appointmentStatus;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getCustomerName() {
+ return customerName;
+ }
+
+ public void setCustomerName(String customerName) {
+ this.customerName = customerName;
+ }
+
+ public String getPetNames() {
+ return petNames;
+ }
+
+ public void setPetNames(String petNames) {
+ this.petNames = petNames;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public LocalDate getAppointmentDate() {
+ return appointmentDate;
+ }
+
+ public void setAppointmentDate(LocalDate appointmentDate) {
+ this.appointmentDate = appointmentDate;
+ }
+
+ public LocalTime getAppointmentTime() {
+ return appointmentTime;
+ }
+
+ public void setAppointmentTime(LocalTime appointmentTime) {
+ this.appointmentTime = appointmentTime;
+ }
+
+ public String getAppointmentStatus() {
+ return appointmentStatus;
+ }
+
+ public void setAppointmentStatus(String appointmentStatus) {
+ this.appointmentStatus = appointmentStatus;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/auth/LoginRequest.java b/src/main/java/org/example/petshopdesktop/api/dto/auth/LoginRequest.java
new file mode 100644
index 00000000..89d6a98f
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/auth/LoginRequest.java
@@ -0,0 +1,30 @@
+package org.example.petshopdesktop.api.dto.auth;
+
+public class LoginRequest {
+ private String username;
+ private String password;
+
+ public LoginRequest() {
+ }
+
+ public LoginRequest(String username, String password) {
+ this.username = username;
+ this.password = password;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/auth/LoginResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/auth/LoginResponse.java
new file mode 100644
index 00000000..18eb8449
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/auth/LoginResponse.java
@@ -0,0 +1,31 @@
+package org.example.petshopdesktop.api.dto.auth;
+
+public class LoginResponse {
+ private String token;
+ private String username;
+ private String role;
+
+ public String getToken() {
+ return token;
+ }
+
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/auth/UserInfoResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/auth/UserInfoResponse.java
new file mode 100644
index 00000000..35192de5
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/auth/UserInfoResponse.java
@@ -0,0 +1,31 @@
+package org.example.petshopdesktop.api.dto.auth;
+
+public class UserInfoResponse {
+ private Long id;
+ private String username;
+ private String role;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/common/BulkDeleteRequest.java b/src/main/java/org/example/petshopdesktop/api/dto/common/BulkDeleteRequest.java
new file mode 100644
index 00000000..d95798ef
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/common/BulkDeleteRequest.java
@@ -0,0 +1,22 @@
+package org.example.petshopdesktop.api.dto.common;
+
+import java.util.List;
+
+public class BulkDeleteRequest {
+ private List ids;
+
+ public BulkDeleteRequest() {
+ }
+
+ public BulkDeleteRequest(List ids) {
+ this.ids = ids;
+ }
+
+ public List getIds() {
+ return ids;
+ }
+
+ public void setIds(List ids) {
+ this.ids = ids;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/common/DropdownOption.java b/src/main/java/org/example/petshopdesktop/api/dto/common/DropdownOption.java
new file mode 100644
index 00000000..b1f24b9c
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/common/DropdownOption.java
@@ -0,0 +1,22 @@
+package org.example.petshopdesktop.api.dto.common;
+
+public class DropdownOption {
+ private Long id;
+ private String label;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/common/PageResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/common/PageResponse.java
new file mode 100644
index 00000000..9676a55d
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/common/PageResponse.java
@@ -0,0 +1,60 @@
+package org.example.petshopdesktop.api.dto.common;
+
+import java.util.List;
+
+public class PageResponse {
+ private List content;
+ private int pageNumber;
+ private int pageSize;
+ private long totalElements;
+ private int totalPages;
+ private boolean last;
+
+ public List getContent() {
+ return content;
+ }
+
+ public void setContent(List content) {
+ this.content = content;
+ }
+
+ public int getPageNumber() {
+ return pageNumber;
+ }
+
+ public void setPageNumber(int pageNumber) {
+ this.pageNumber = pageNumber;
+ }
+
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ public void setPageSize(int pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ public long getTotalElements() {
+ return totalElements;
+ }
+
+ public void setTotalElements(long totalElements) {
+ this.totalElements = totalElements;
+ }
+
+ public int getTotalPages() {
+ return totalPages;
+ }
+
+ public void setTotalPages(int totalPages) {
+ this.totalPages = totalPages;
+ }
+
+ public boolean isLast() {
+ return last;
+ }
+
+ public void setLast(boolean last) {
+ this.last = last;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/inventory/InventoryRequest.java b/src/main/java/org/example/petshopdesktop/api/dto/inventory/InventoryRequest.java
new file mode 100644
index 00000000..4eb99cd0
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/inventory/InventoryRequest.java
@@ -0,0 +1,40 @@
+package org.example.petshopdesktop.api.dto.inventory;
+
+public class InventoryRequest {
+ private Long productId;
+ private Long storeId;
+ private Integer stockQuantity;
+ private Integer reorderLevel;
+
+ public Long getProductId() {
+ return productId;
+ }
+
+ public void setProductId(Long productId) {
+ this.productId = productId;
+ }
+
+ public Long getStoreId() {
+ return storeId;
+ }
+
+ public void setStoreId(Long storeId) {
+ this.storeId = storeId;
+ }
+
+ public Integer getStockQuantity() {
+ return stockQuantity;
+ }
+
+ public void setStockQuantity(Integer stockQuantity) {
+ this.stockQuantity = stockQuantity;
+ }
+
+ public Integer getReorderLevel() {
+ return reorderLevel;
+ }
+
+ public void setReorderLevel(Integer reorderLevel) {
+ this.reorderLevel = reorderLevel;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/inventory/InventoryResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/inventory/InventoryResponse.java
new file mode 100644
index 00000000..7a9ac8b7
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/inventory/InventoryResponse.java
@@ -0,0 +1,58 @@
+package org.example.petshopdesktop.api.dto.inventory;
+
+public class InventoryResponse {
+ private Long id;
+ private String productName;
+ private String categoryName;
+ private String storeName;
+ private Integer stockQuantity;
+ private Integer reorderLevel;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getProductName() {
+ return productName;
+ }
+
+ public void setProductName(String productName) {
+ this.productName = productName;
+ }
+
+ public String getCategoryName() {
+ return categoryName;
+ }
+
+ public void setCategoryName(String categoryName) {
+ this.categoryName = categoryName;
+ }
+
+ public String getStoreName() {
+ return storeName;
+ }
+
+ public void setStoreName(String storeName) {
+ this.storeName = storeName;
+ }
+
+ public Integer getStockQuantity() {
+ return stockQuantity;
+ }
+
+ public void setStockQuantity(Integer stockQuantity) {
+ this.stockQuantity = stockQuantity;
+ }
+
+ public Integer getReorderLevel() {
+ return reorderLevel;
+ }
+
+ public void setReorderLevel(Integer reorderLevel) {
+ this.reorderLevel = reorderLevel;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/pet/PetRequest.java b/src/main/java/org/example/petshopdesktop/api/dto/pet/PetRequest.java
new file mode 100644
index 00000000..a67d3e45
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/pet/PetRequest.java
@@ -0,0 +1,79 @@
+package org.example.petshopdesktop.api.dto.pet;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+public class PetRequest {
+ private String petName;
+ private String species;
+ private String breed;
+ private LocalDate dateOfBirth;
+ private String gender;
+ private String color;
+ private BigDecimal price;
+ private String petStatus;
+
+ public String getPetName() {
+ return petName;
+ }
+
+ public void setPetName(String petName) {
+ this.petName = petName;
+ }
+
+ public String getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(String species) {
+ this.species = species;
+ }
+
+ public String getBreed() {
+ return breed;
+ }
+
+ public void setBreed(String breed) {
+ this.breed = breed;
+ }
+
+ public LocalDate getDateOfBirth() {
+ return dateOfBirth;
+ }
+
+ public void setDateOfBirth(LocalDate dateOfBirth) {
+ this.dateOfBirth = dateOfBirth;
+ }
+
+ public String getGender() {
+ return gender;
+ }
+
+ public void setGender(String gender) {
+ this.gender = gender;
+ }
+
+ public String getColor() {
+ return color;
+ }
+
+ public void setColor(String color) {
+ this.color = color;
+ }
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+
+ public String getPetStatus() {
+ return petStatus;
+ }
+
+ public void setPetStatus(String petStatus) {
+ this.petStatus = petStatus;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/pet/PetResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/pet/PetResponse.java
new file mode 100644
index 00000000..5565e583
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/pet/PetResponse.java
@@ -0,0 +1,88 @@
+package org.example.petshopdesktop.api.dto.pet;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+public class PetResponse {
+ private Long id;
+ private String petName;
+ private String species;
+ private String breed;
+ private LocalDate dateOfBirth;
+ private String gender;
+ private String color;
+ private BigDecimal price;
+ private String petStatus;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getPetName() {
+ return petName;
+ }
+
+ public void setPetName(String petName) {
+ this.petName = petName;
+ }
+
+ public String getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(String species) {
+ this.species = species;
+ }
+
+ public String getBreed() {
+ return breed;
+ }
+
+ public void setBreed(String breed) {
+ this.breed = breed;
+ }
+
+ public LocalDate getDateOfBirth() {
+ return dateOfBirth;
+ }
+
+ public void setDateOfBirth(LocalDate dateOfBirth) {
+ this.dateOfBirth = dateOfBirth;
+ }
+
+ public String getGender() {
+ return gender;
+ }
+
+ public void setGender(String gender) {
+ this.gender = gender;
+ }
+
+ public String getColor() {
+ return color;
+ }
+
+ public void setColor(String color) {
+ this.color = color;
+ }
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+
+ public String getPetStatus() {
+ return petStatus;
+ }
+
+ public void setPetStatus(String petStatus) {
+ this.petStatus = petStatus;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/product/ProductRequest.java b/src/main/java/org/example/petshopdesktop/api/dto/product/ProductRequest.java
new file mode 100644
index 00000000..a51ee4d0
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/product/ProductRequest.java
@@ -0,0 +1,42 @@
+package org.example.petshopdesktop.api.dto.product;
+
+import java.math.BigDecimal;
+
+public class ProductRequest {
+ private String productName;
+ private Long categoryId;
+ private BigDecimal price;
+ private String description;
+
+ public String getProductName() {
+ return productName;
+ }
+
+ public void setProductName(String productName) {
+ this.productName = productName;
+ }
+
+ public Long getCategoryId() {
+ return categoryId;
+ }
+
+ public void setCategoryId(Long categoryId) {
+ this.categoryId = categoryId;
+ }
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/product/ProductResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/product/ProductResponse.java
new file mode 100644
index 00000000..07efa236
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/product/ProductResponse.java
@@ -0,0 +1,51 @@
+package org.example.petshopdesktop.api.dto.product;
+
+import java.math.BigDecimal;
+
+public class ProductResponse {
+ private Long id;
+ private String productName;
+ private String categoryName;
+ private BigDecimal price;
+ private String description;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getProductName() {
+ return productName;
+ }
+
+ public void setProductName(String productName) {
+ this.productName = productName;
+ }
+
+ public String getCategoryName() {
+ return categoryName;
+ }
+
+ public void setCategoryName(String categoryName) {
+ this.categoryName = categoryName;
+ }
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/productsupplier/ProductSupplierRequest.java b/src/main/java/org/example/petshopdesktop/api/dto/productsupplier/ProductSupplierRequest.java
new file mode 100644
index 00000000..e57d3801
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/productsupplier/ProductSupplierRequest.java
@@ -0,0 +1,33 @@
+package org.example.petshopdesktop.api.dto.productsupplier;
+
+import java.math.BigDecimal;
+
+public class ProductSupplierRequest {
+ private Long productId;
+ private Long supplierId;
+ private BigDecimal supplierPrice;
+
+ public Long getProductId() {
+ return productId;
+ }
+
+ public void setProductId(Long productId) {
+ this.productId = productId;
+ }
+
+ public Long getSupplierId() {
+ return supplierId;
+ }
+
+ public void setSupplierId(Long supplierId) {
+ this.supplierId = supplierId;
+ }
+
+ public BigDecimal getSupplierPrice() {
+ return supplierPrice;
+ }
+
+ public void setSupplierPrice(BigDecimal supplierPrice) {
+ this.supplierPrice = supplierPrice;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/productsupplier/ProductSupplierResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/productsupplier/ProductSupplierResponse.java
new file mode 100644
index 00000000..4f4ed246
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/productsupplier/ProductSupplierResponse.java
@@ -0,0 +1,42 @@
+package org.example.petshopdesktop.api.dto.productsupplier;
+
+import java.math.BigDecimal;
+
+public class ProductSupplierResponse {
+ private Long id;
+ private String productName;
+ private String supplierName;
+ private BigDecimal supplierPrice;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getProductName() {
+ return productName;
+ }
+
+ public void setProductName(String productName) {
+ this.productName = productName;
+ }
+
+ public String getSupplierName() {
+ return supplierName;
+ }
+
+ public void setSupplierName(String supplierName) {
+ this.supplierName = supplierName;
+ }
+
+ public BigDecimal getSupplierPrice() {
+ return supplierPrice;
+ }
+
+ public void setSupplierPrice(BigDecimal supplierPrice) {
+ this.supplierPrice = supplierPrice;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/purchaseorder/PurchaseOrderResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/purchaseorder/PurchaseOrderResponse.java
new file mode 100644
index 00000000..8bc1c13c
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/purchaseorder/PurchaseOrderResponse.java
@@ -0,0 +1,61 @@
+package org.example.petshopdesktop.api.dto.purchaseorder;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+public class PurchaseOrderResponse {
+ private Long id;
+ private String supplierName;
+ private LocalDate orderDate;
+ private LocalDate expectedDeliveryDate;
+ private String orderStatus;
+ private BigDecimal totalAmount;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getSupplierName() {
+ return supplierName;
+ }
+
+ public void setSupplierName(String supplierName) {
+ this.supplierName = supplierName;
+ }
+
+ public LocalDate getOrderDate() {
+ return orderDate;
+ }
+
+ public void setOrderDate(LocalDate orderDate) {
+ this.orderDate = orderDate;
+ }
+
+ public LocalDate getExpectedDeliveryDate() {
+ return expectedDeliveryDate;
+ }
+
+ public void setExpectedDeliveryDate(LocalDate expectedDeliveryDate) {
+ this.expectedDeliveryDate = expectedDeliveryDate;
+ }
+
+ public String getOrderStatus() {
+ return orderStatus;
+ }
+
+ public void setOrderStatus(String orderStatus) {
+ this.orderStatus = orderStatus;
+ }
+
+ public BigDecimal getTotalAmount() {
+ return totalAmount;
+ }
+
+ public void setTotalAmount(BigDecimal totalAmount) {
+ this.totalAmount = totalAmount;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/sale/SaleItemRequest.java b/src/main/java/org/example/petshopdesktop/api/dto/sale/SaleItemRequest.java
new file mode 100644
index 00000000..a853a608
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/sale/SaleItemRequest.java
@@ -0,0 +1,33 @@
+package org.example.petshopdesktop.api.dto.sale;
+
+import java.math.BigDecimal;
+
+public class SaleItemRequest {
+ private Long productId;
+ private Integer quantity;
+ private BigDecimal unitPrice;
+
+ public Long getProductId() {
+ return productId;
+ }
+
+ public void setProductId(Long productId) {
+ this.productId = productId;
+ }
+
+ public Integer getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(Integer quantity) {
+ this.quantity = quantity;
+ }
+
+ public BigDecimal getUnitPrice() {
+ return unitPrice;
+ }
+
+ public void setUnitPrice(BigDecimal unitPrice) {
+ this.unitPrice = unitPrice;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/sale/SaleItemResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/sale/SaleItemResponse.java
new file mode 100644
index 00000000..98d989bf
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/sale/SaleItemResponse.java
@@ -0,0 +1,51 @@
+package org.example.petshopdesktop.api.dto.sale;
+
+import java.math.BigDecimal;
+
+public class SaleItemResponse {
+ private Long id;
+ private String productName;
+ private Integer quantity;
+ private BigDecimal unitPrice;
+ private BigDecimal lineTotal;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getProductName() {
+ return productName;
+ }
+
+ public void setProductName(String productName) {
+ this.productName = productName;
+ }
+
+ public Integer getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(Integer quantity) {
+ this.quantity = quantity;
+ }
+
+ public BigDecimal getUnitPrice() {
+ return unitPrice;
+ }
+
+ public void setUnitPrice(BigDecimal unitPrice) {
+ this.unitPrice = unitPrice;
+ }
+
+ public BigDecimal getLineTotal() {
+ return lineTotal;
+ }
+
+ public void setLineTotal(BigDecimal lineTotal) {
+ this.lineTotal = lineTotal;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/sale/SaleRequest.java b/src/main/java/org/example/petshopdesktop/api/dto/sale/SaleRequest.java
new file mode 100644
index 00000000..cb856e06
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/sale/SaleRequest.java
@@ -0,0 +1,51 @@
+package org.example.petshopdesktop.api.dto.sale;
+
+import java.util.List;
+
+public class SaleRequest {
+ private Long storeId;
+ private String paymentMethod;
+ private List items;
+ private Boolean isRefund;
+ private Long originalSaleId;
+
+ public Long getStoreId() {
+ return storeId;
+ }
+
+ public void setStoreId(Long storeId) {
+ this.storeId = storeId;
+ }
+
+ public String getPaymentMethod() {
+ return paymentMethod;
+ }
+
+ public void setPaymentMethod(String paymentMethod) {
+ this.paymentMethod = paymentMethod;
+ }
+
+ public List getItems() {
+ return items;
+ }
+
+ public void setItems(List items) {
+ this.items = items;
+ }
+
+ public Boolean getIsRefund() {
+ return isRefund;
+ }
+
+ public void setIsRefund(Boolean isRefund) {
+ this.isRefund = isRefund;
+ }
+
+ public Long getOriginalSaleId() {
+ return originalSaleId;
+ }
+
+ public void setOriginalSaleId(Long originalSaleId) {
+ this.originalSaleId = originalSaleId;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/sale/SaleResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/sale/SaleResponse.java
new file mode 100644
index 00000000..e2ed8111
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/sale/SaleResponse.java
@@ -0,0 +1,89 @@
+package org.example.petshopdesktop.api.dto.sale;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.List;
+
+public class SaleResponse {
+ private Long id;
+ private String employeeName;
+ private String storeName;
+ private LocalDateTime saleDate;
+ private BigDecimal totalAmount;
+ private String paymentMethod;
+ private Boolean isRefund;
+ private Long originalSaleId;
+ private List items;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getEmployeeName() {
+ return employeeName;
+ }
+
+ public void setEmployeeName(String employeeName) {
+ this.employeeName = employeeName;
+ }
+
+ public String getStoreName() {
+ return storeName;
+ }
+
+ public void setStoreName(String storeName) {
+ this.storeName = storeName;
+ }
+
+ public LocalDateTime getSaleDate() {
+ return saleDate;
+ }
+
+ public void setSaleDate(LocalDateTime saleDate) {
+ this.saleDate = saleDate;
+ }
+
+ public BigDecimal getTotalAmount() {
+ return totalAmount;
+ }
+
+ public void setTotalAmount(BigDecimal totalAmount) {
+ this.totalAmount = totalAmount;
+ }
+
+ public String getPaymentMethod() {
+ return paymentMethod;
+ }
+
+ public void setPaymentMethod(String paymentMethod) {
+ this.paymentMethod = paymentMethod;
+ }
+
+ public Boolean getIsRefund() {
+ return isRefund;
+ }
+
+ public void setIsRefund(Boolean isRefund) {
+ this.isRefund = isRefund;
+ }
+
+ public Long getOriginalSaleId() {
+ return originalSaleId;
+ }
+
+ public void setOriginalSaleId(Long originalSaleId) {
+ this.originalSaleId = originalSaleId;
+ }
+
+ public List getItems() {
+ return items;
+ }
+
+ public void setItems(List items) {
+ this.items = items;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/service/ServiceRequest.java b/src/main/java/org/example/petshopdesktop/api/dto/service/ServiceRequest.java
new file mode 100644
index 00000000..11d7659a
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/service/ServiceRequest.java
@@ -0,0 +1,33 @@
+package org.example.petshopdesktop.api.dto.service;
+
+import java.math.BigDecimal;
+
+public class ServiceRequest {
+ private String serviceName;
+ private BigDecimal price;
+ private String description;
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/service/ServiceResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/service/ServiceResponse.java
new file mode 100644
index 00000000..e3e61a08
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/service/ServiceResponse.java
@@ -0,0 +1,42 @@
+package org.example.petshopdesktop.api.dto.service;
+
+import java.math.BigDecimal;
+
+public class ServiceResponse {
+ private Long id;
+ private String serviceName;
+ private BigDecimal price;
+ private String description;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/supplier/SupplierRequest.java b/src/main/java/org/example/petshopdesktop/api/dto/supplier/SupplierRequest.java
new file mode 100644
index 00000000..51b31b96
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/supplier/SupplierRequest.java
@@ -0,0 +1,49 @@
+package org.example.petshopdesktop.api.dto.supplier;
+
+public class SupplierRequest {
+ private String supplierName;
+ private String contactPerson;
+ private String phone;
+ private String email;
+ private String address;
+
+ public String getSupplierName() {
+ return supplierName;
+ }
+
+ public void setSupplierName(String supplierName) {
+ this.supplierName = supplierName;
+ }
+
+ public String getContactPerson() {
+ return contactPerson;
+ }
+
+ public void setContactPerson(String contactPerson) {
+ this.contactPerson = contactPerson;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/supplier/SupplierResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/supplier/SupplierResponse.java
new file mode 100644
index 00000000..5aebfbab
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/supplier/SupplierResponse.java
@@ -0,0 +1,58 @@
+package org.example.petshopdesktop.api.dto.supplier;
+
+public class SupplierResponse {
+ private Long id;
+ private String supplierName;
+ private String contactPerson;
+ private String phone;
+ private String email;
+ private String address;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getSupplierName() {
+ return supplierName;
+ }
+
+ public void setSupplierName(String supplierName) {
+ this.supplierName = supplierName;
+ }
+
+ public String getContactPerson() {
+ return contactPerson;
+ }
+
+ public void setContactPerson(String contactPerson) {
+ this.contactPerson = contactPerson;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/user/UserRequest.java b/src/main/java/org/example/petshopdesktop/api/dto/user/UserRequest.java
new file mode 100644
index 00000000..faa63bcf
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/user/UserRequest.java
@@ -0,0 +1,58 @@
+package org.example.petshopdesktop.api.dto.user;
+
+public class UserRequest {
+ private String username;
+ private String password;
+ private String firstName;
+ private String lastName;
+ private String role;
+ private Boolean active;
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+ public Boolean getActive() {
+ return active;
+ }
+
+ public void setActive(Boolean active) {
+ this.active = active;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/dto/user/UserResponse.java b/src/main/java/org/example/petshopdesktop/api/dto/user/UserResponse.java
new file mode 100644
index 00000000..74776269
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/dto/user/UserResponse.java
@@ -0,0 +1,60 @@
+package org.example.petshopdesktop.api.dto.user;
+
+import java.time.LocalDateTime;
+
+public class UserResponse {
+ private Long id;
+ private String username;
+ private String fullName;
+ private String role;
+ private Boolean active;
+ private LocalDateTime createdAt;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getFullName() {
+ return fullName;
+ }
+
+ public void setFullName(String fullName) {
+ this.fullName = fullName;
+ }
+
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+ public Boolean getActive() {
+ return active;
+ }
+
+ public void setActive(Boolean active) {
+ this.active = active;
+ }
+
+ public LocalDateTime getCreatedAt() {
+ return createdAt;
+ }
+
+ public void setCreatedAt(LocalDateTime createdAt) {
+ this.createdAt = createdAt;
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/endpoints/AdoptionApi.java b/src/main/java/org/example/petshopdesktop/api/endpoints/AdoptionApi.java
new file mode 100644
index 00000000..f5c0f8e4
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/endpoints/AdoptionApi.java
@@ -0,0 +1,43 @@
+package org.example.petshopdesktop.api.endpoints;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import org.example.petshopdesktop.api.ApiClient;
+import org.example.petshopdesktop.api.dto.adoption.AdoptionRequest;
+import org.example.petshopdesktop.api.dto.adoption.AdoptionResponse;
+import org.example.petshopdesktop.api.dto.common.BulkDeleteRequest;
+
+import java.util.List;
+
+public class AdoptionApi {
+ private static final AdoptionApi INSTANCE = new AdoptionApi();
+ private final ApiClient apiClient;
+
+ private AdoptionApi() {
+ this.apiClient = ApiClient.getInstance();
+ }
+
+ public static AdoptionApi getInstance() {
+ return INSTANCE;
+ }
+
+ public List listAdoptions(String query) throws Exception {
+ String path = "/api/v1/adoptions?page=0&size=1000";
+ if (query != null && !query.isEmpty()) {
+ path += "&q=" + query;
+ }
+ String response = apiClient.get(path, String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public AdoptionResponse createAdoption(AdoptionRequest request) throws Exception {
+ return apiClient.post("/api/v1/adoptions", request, AdoptionResponse.class);
+ }
+
+ public AdoptionResponse updateAdoption(Long id, AdoptionRequest request) throws Exception {
+ return apiClient.put("/api/v1/adoptions/" + id, request, AdoptionResponse.class);
+ }
+
+ public void deleteAdoptions(List ids) throws Exception {
+ apiClient.deleteWithBody("/api/v1/adoptions", new BulkDeleteRequest(ids));
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/endpoints/AnalyticsApi.java b/src/main/java/org/example/petshopdesktop/api/endpoints/AnalyticsApi.java
new file mode 100644
index 00000000..ebecd9c2
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/endpoints/AnalyticsApi.java
@@ -0,0 +1,22 @@
+package org.example.petshopdesktop.api.endpoints;
+
+import org.example.petshopdesktop.api.ApiClient;
+import org.example.petshopdesktop.api.dto.analytics.DashboardResponse;
+
+public class AnalyticsApi {
+ private static final AnalyticsApi INSTANCE = new AnalyticsApi();
+ private final ApiClient apiClient;
+
+ private AnalyticsApi() {
+ this.apiClient = ApiClient.getInstance();
+ }
+
+ public static AnalyticsApi getInstance() {
+ return INSTANCE;
+ }
+
+ public DashboardResponse getDashboard(int days, int top) throws Exception {
+ String path = "/api/v1/analytics/dashboard?days=" + days + "&top=" + top;
+ return apiClient.get(path, DashboardResponse.class);
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/endpoints/AppointmentApi.java b/src/main/java/org/example/petshopdesktop/api/endpoints/AppointmentApi.java
new file mode 100644
index 00000000..e7d1410a
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/endpoints/AppointmentApi.java
@@ -0,0 +1,43 @@
+package org.example.petshopdesktop.api.endpoints;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import org.example.petshopdesktop.api.ApiClient;
+import org.example.petshopdesktop.api.dto.appointment.AppointmentRequest;
+import org.example.petshopdesktop.api.dto.appointment.AppointmentResponse;
+import org.example.petshopdesktop.api.dto.common.BulkDeleteRequest;
+
+import java.util.List;
+
+public class AppointmentApi {
+ private static final AppointmentApi INSTANCE = new AppointmentApi();
+ private final ApiClient apiClient;
+
+ private AppointmentApi() {
+ this.apiClient = ApiClient.getInstance();
+ }
+
+ public static AppointmentApi getInstance() {
+ return INSTANCE;
+ }
+
+ public List listAppointments(String query) throws Exception {
+ String path = "/api/v1/appointments?page=0&size=1000";
+ if (query != null && !query.isEmpty()) {
+ path += "&q=" + query;
+ }
+ String response = apiClient.get(path, String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public AppointmentResponse createAppointment(AppointmentRequest request) throws Exception {
+ return apiClient.post("/api/v1/appointments", request, AppointmentResponse.class);
+ }
+
+ public AppointmentResponse updateAppointment(Long id, AppointmentRequest request) throws Exception {
+ return apiClient.put("/api/v1/appointments/" + id, request, AppointmentResponse.class);
+ }
+
+ public void deleteAppointments(List ids) throws Exception {
+ apiClient.deleteWithBody("/api/v1/appointments", new BulkDeleteRequest(ids));
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/endpoints/DropdownApi.java b/src/main/java/org/example/petshopdesktop/api/endpoints/DropdownApi.java
new file mode 100644
index 00000000..bff7998c
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/endpoints/DropdownApi.java
@@ -0,0 +1,55 @@
+package org.example.petshopdesktop.api.endpoints;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import org.example.petshopdesktop.api.ApiClient;
+import org.example.petshopdesktop.api.dto.common.DropdownOption;
+
+import java.util.List;
+
+public class DropdownApi {
+ private static final DropdownApi INSTANCE = new DropdownApi();
+ private final ApiClient apiClient;
+
+ private DropdownApi() {
+ this.apiClient = ApiClient.getInstance();
+ }
+
+ public static DropdownApi getInstance() {
+ return INSTANCE;
+ }
+
+ public List getCategories() throws Exception {
+ String response = apiClient.get("/api/v1/dropdowns/categories", String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public List getProducts() throws Exception {
+ String response = apiClient.get("/api/v1/dropdowns/products", String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public List getSuppliers() throws Exception {
+ String response = apiClient.get("/api/v1/dropdowns/suppliers", String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public List getServices() throws Exception {
+ String response = apiClient.get("/api/v1/dropdowns/services", String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public List getCustomers() throws Exception {
+ String response = apiClient.get("/api/v1/dropdowns/customers", String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public List getPets() throws Exception {
+ String response = apiClient.get("/api/v1/dropdowns/pets", String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public List getStores() throws Exception {
+ String response = apiClient.get("/api/v1/dropdowns/stores", String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/endpoints/InventoryApi.java b/src/main/java/org/example/petshopdesktop/api/endpoints/InventoryApi.java
new file mode 100644
index 00000000..1712576e
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/endpoints/InventoryApi.java
@@ -0,0 +1,42 @@
+package org.example.petshopdesktop.api.endpoints;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import org.example.petshopdesktop.api.ApiClient;
+import org.example.petshopdesktop.api.dto.inventory.InventoryRequest;
+import org.example.petshopdesktop.api.dto.inventory.InventoryResponse;
+
+import java.util.List;
+
+public class InventoryApi {
+ private static final InventoryApi INSTANCE = new InventoryApi();
+ private final ApiClient apiClient;
+
+ private InventoryApi() {
+ this.apiClient = ApiClient.getInstance();
+ }
+
+ public static InventoryApi getInstance() {
+ return INSTANCE;
+ }
+
+ public List listInventory(String query) throws Exception {
+ String path = "/api/v1/inventory?page=0&size=1000";
+ if (query != null && !query.isEmpty()) {
+ path += "&q=" + query;
+ }
+ String response = apiClient.get(path, String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public InventoryResponse createInventory(InventoryRequest request) throws Exception {
+ return apiClient.post("/api/v1/inventory", request, InventoryResponse.class);
+ }
+
+ public InventoryResponse updateInventory(Long id, InventoryRequest request) throws Exception {
+ return apiClient.put("/api/v1/inventory/" + id, request, InventoryResponse.class);
+ }
+
+ public void deleteInventory(Long id) throws Exception {
+ apiClient.delete("/api/v1/inventory/" + id);
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/endpoints/PetApi.java b/src/main/java/org/example/petshopdesktop/api/endpoints/PetApi.java
new file mode 100644
index 00000000..73b2c55c
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/endpoints/PetApi.java
@@ -0,0 +1,43 @@
+package org.example.petshopdesktop.api.endpoints;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import org.example.petshopdesktop.api.ApiClient;
+import org.example.petshopdesktop.api.dto.common.BulkDeleteRequest;
+import org.example.petshopdesktop.api.dto.pet.PetRequest;
+import org.example.petshopdesktop.api.dto.pet.PetResponse;
+
+import java.util.List;
+
+public class PetApi {
+ private static final PetApi INSTANCE = new PetApi();
+ private final ApiClient apiClient;
+
+ private PetApi() {
+ this.apiClient = ApiClient.getInstance();
+ }
+
+ public static PetApi getInstance() {
+ return INSTANCE;
+ }
+
+ public List listPets(String query) throws Exception {
+ String path = "/api/v1/pets?page=0&size=1000";
+ if (query != null && !query.isEmpty()) {
+ path += "&q=" + query;
+ }
+ String response = apiClient.get(path, String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public PetResponse createPet(PetRequest request) throws Exception {
+ return apiClient.post("/api/v1/pets", request, PetResponse.class);
+ }
+
+ public PetResponse updatePet(Long id, PetRequest request) throws Exception {
+ return apiClient.put("/api/v1/pets/" + id, request, PetResponse.class);
+ }
+
+ public void deletePets(List ids) throws Exception {
+ apiClient.deleteWithBody("/api/v1/pets", new BulkDeleteRequest(ids));
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/endpoints/ProductApi.java b/src/main/java/org/example/petshopdesktop/api/endpoints/ProductApi.java
new file mode 100644
index 00000000..3a40ec76
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/endpoints/ProductApi.java
@@ -0,0 +1,43 @@
+package org.example.petshopdesktop.api.endpoints;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import org.example.petshopdesktop.api.ApiClient;
+import org.example.petshopdesktop.api.dto.common.BulkDeleteRequest;
+import org.example.petshopdesktop.api.dto.product.ProductRequest;
+import org.example.petshopdesktop.api.dto.product.ProductResponse;
+
+import java.util.List;
+
+public class ProductApi {
+ private static final ProductApi INSTANCE = new ProductApi();
+ private final ApiClient apiClient;
+
+ private ProductApi() {
+ this.apiClient = ApiClient.getInstance();
+ }
+
+ public static ProductApi getInstance() {
+ return INSTANCE;
+ }
+
+ public List listProducts(String query) throws Exception {
+ String path = "/api/v1/products?page=0&size=1000";
+ if (query != null && !query.isEmpty()) {
+ path += "&q=" + query;
+ }
+ String response = apiClient.get(path, String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public ProductResponse createProduct(ProductRequest request) throws Exception {
+ return apiClient.post("/api/v1/products", request, ProductResponse.class);
+ }
+
+ public ProductResponse updateProduct(Long id, ProductRequest request) throws Exception {
+ return apiClient.put("/api/v1/products/" + id, request, ProductResponse.class);
+ }
+
+ public void deleteProducts(List ids) throws Exception {
+ apiClient.deleteWithBody("/api/v1/products", new BulkDeleteRequest(ids));
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/endpoints/ProductSupplierApi.java b/src/main/java/org/example/petshopdesktop/api/endpoints/ProductSupplierApi.java
new file mode 100644
index 00000000..b98c3d74
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/endpoints/ProductSupplierApi.java
@@ -0,0 +1,43 @@
+package org.example.petshopdesktop.api.endpoints;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import org.example.petshopdesktop.api.ApiClient;
+import org.example.petshopdesktop.api.dto.common.BulkDeleteRequest;
+import org.example.petshopdesktop.api.dto.productsupplier.ProductSupplierRequest;
+import org.example.petshopdesktop.api.dto.productsupplier.ProductSupplierResponse;
+
+import java.util.List;
+
+public class ProductSupplierApi {
+ private static final ProductSupplierApi INSTANCE = new ProductSupplierApi();
+ private final ApiClient apiClient;
+
+ private ProductSupplierApi() {
+ this.apiClient = ApiClient.getInstance();
+ }
+
+ public static ProductSupplierApi getInstance() {
+ return INSTANCE;
+ }
+
+ public List listProductSuppliers(String query) throws Exception {
+ String path = "/api/v1/product-suppliers?page=0&size=1000";
+ if (query != null && !query.isEmpty()) {
+ path += "&q=" + query;
+ }
+ String response = apiClient.get(path, String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public ProductSupplierResponse createProductSupplier(ProductSupplierRequest request) throws Exception {
+ return apiClient.post("/api/v1/product-suppliers", request, ProductSupplierResponse.class);
+ }
+
+ public ProductSupplierResponse updateProductSupplier(Long id, ProductSupplierRequest request) throws Exception {
+ return apiClient.put("/api/v1/product-suppliers/" + id, request, ProductSupplierResponse.class);
+ }
+
+ public void deleteProductSuppliers(List ids) throws Exception {
+ apiClient.deleteWithBody("/api/v1/product-suppliers", new BulkDeleteRequest(ids));
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/endpoints/PurchaseOrderApi.java b/src/main/java/org/example/petshopdesktop/api/endpoints/PurchaseOrderApi.java
new file mode 100644
index 00000000..3b9cd558
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/endpoints/PurchaseOrderApi.java
@@ -0,0 +1,29 @@
+package org.example.petshopdesktop.api.endpoints;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import org.example.petshopdesktop.api.ApiClient;
+import org.example.petshopdesktop.api.dto.purchaseorder.PurchaseOrderResponse;
+
+import java.util.List;
+
+public class PurchaseOrderApi {
+ private static final PurchaseOrderApi INSTANCE = new PurchaseOrderApi();
+ private final ApiClient apiClient;
+
+ private PurchaseOrderApi() {
+ this.apiClient = ApiClient.getInstance();
+ }
+
+ public static PurchaseOrderApi getInstance() {
+ return INSTANCE;
+ }
+
+ public List listPurchaseOrders(String query) throws Exception {
+ String path = "/api/v1/purchase-orders?page=0&size=1000";
+ if (query != null && !query.isEmpty()) {
+ path += "&q=" + query;
+ }
+ String response = apiClient.get(path, String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/endpoints/SaleApi.java b/src/main/java/org/example/petshopdesktop/api/endpoints/SaleApi.java
new file mode 100644
index 00000000..f1e18733
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/endpoints/SaleApi.java
@@ -0,0 +1,38 @@
+package org.example.petshopdesktop.api.endpoints;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import org.example.petshopdesktop.api.ApiClient;
+import org.example.petshopdesktop.api.dto.sale.SaleRequest;
+import org.example.petshopdesktop.api.dto.sale.SaleResponse;
+
+import java.util.List;
+
+public class SaleApi {
+ private static final SaleApi INSTANCE = new SaleApi();
+ private final ApiClient apiClient;
+
+ private SaleApi() {
+ this.apiClient = ApiClient.getInstance();
+ }
+
+ public static SaleApi getInstance() {
+ return INSTANCE;
+ }
+
+ public List listSales(int page, int size, String query) throws Exception {
+ String path = "/api/v1/sales?page=" + page + "&size=" + size;
+ if (query != null && !query.isEmpty()) {
+ path += "&q=" + query;
+ }
+ String response = apiClient.get(path, String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public SaleResponse getSale(Long id) throws Exception {
+ return apiClient.get("/api/v1/sales/" + id, SaleResponse.class);
+ }
+
+ public SaleResponse createSale(SaleRequest request) throws Exception {
+ return apiClient.post("/api/v1/sales", request, SaleResponse.class);
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/endpoints/ServiceApi.java b/src/main/java/org/example/petshopdesktop/api/endpoints/ServiceApi.java
new file mode 100644
index 00000000..3ca554f1
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/endpoints/ServiceApi.java
@@ -0,0 +1,43 @@
+package org.example.petshopdesktop.api.endpoints;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import org.example.petshopdesktop.api.ApiClient;
+import org.example.petshopdesktop.api.dto.common.BulkDeleteRequest;
+import org.example.petshopdesktop.api.dto.service.ServiceRequest;
+import org.example.petshopdesktop.api.dto.service.ServiceResponse;
+
+import java.util.List;
+
+public class ServiceApi {
+ private static final ServiceApi INSTANCE = new ServiceApi();
+ private final ApiClient apiClient;
+
+ private ServiceApi() {
+ this.apiClient = ApiClient.getInstance();
+ }
+
+ public static ServiceApi getInstance() {
+ return INSTANCE;
+ }
+
+ public List listServices(String query) throws Exception {
+ String path = "/api/v1/services?page=0&size=1000";
+ if (query != null && !query.isEmpty()) {
+ path += "&q=" + query;
+ }
+ String response = apiClient.get(path, String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public ServiceResponse createService(ServiceRequest request) throws Exception {
+ return apiClient.post("/api/v1/services", request, ServiceResponse.class);
+ }
+
+ public ServiceResponse updateService(Long id, ServiceRequest request) throws Exception {
+ return apiClient.put("/api/v1/services/" + id, request, ServiceResponse.class);
+ }
+
+ public void deleteServices(List ids) throws Exception {
+ apiClient.deleteWithBody("/api/v1/services", new BulkDeleteRequest(ids));
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/endpoints/SupplierApi.java b/src/main/java/org/example/petshopdesktop/api/endpoints/SupplierApi.java
new file mode 100644
index 00000000..9fe5eaad
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/endpoints/SupplierApi.java
@@ -0,0 +1,43 @@
+package org.example.petshopdesktop.api.endpoints;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import org.example.petshopdesktop.api.ApiClient;
+import org.example.petshopdesktop.api.dto.common.BulkDeleteRequest;
+import org.example.petshopdesktop.api.dto.supplier.SupplierRequest;
+import org.example.petshopdesktop.api.dto.supplier.SupplierResponse;
+
+import java.util.List;
+
+public class SupplierApi {
+ private static final SupplierApi INSTANCE = new SupplierApi();
+ private final ApiClient apiClient;
+
+ private SupplierApi() {
+ this.apiClient = ApiClient.getInstance();
+ }
+
+ public static SupplierApi getInstance() {
+ return INSTANCE;
+ }
+
+ public List listSuppliers(String query) throws Exception {
+ String path = "/api/v1/suppliers?page=0&size=1000";
+ if (query != null && !query.isEmpty()) {
+ path += "&q=" + query;
+ }
+ String response = apiClient.get(path, String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public SupplierResponse createSupplier(SupplierRequest request) throws Exception {
+ return apiClient.post("/api/v1/suppliers", request, SupplierResponse.class);
+ }
+
+ public SupplierResponse updateSupplier(Long id, SupplierRequest request) throws Exception {
+ return apiClient.put("/api/v1/suppliers/" + id, request, SupplierResponse.class);
+ }
+
+ public void deleteSuppliers(List ids) throws Exception {
+ apiClient.deleteWithBody("/api/v1/suppliers", new BulkDeleteRequest(ids));
+ }
+}
diff --git a/src/main/java/org/example/petshopdesktop/api/endpoints/UserApi.java b/src/main/java/org/example/petshopdesktop/api/endpoints/UserApi.java
new file mode 100644
index 00000000..54a58c0e
--- /dev/null
+++ b/src/main/java/org/example/petshopdesktop/api/endpoints/UserApi.java
@@ -0,0 +1,34 @@
+package org.example.petshopdesktop.api.endpoints;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import org.example.petshopdesktop.api.ApiClient;
+import org.example.petshopdesktop.api.dto.user.UserRequest;
+import org.example.petshopdesktop.api.dto.user.UserResponse;
+
+import java.util.List;
+
+public class UserApi {
+ private static final UserApi INSTANCE = new UserApi();
+ private final ApiClient apiClient;
+
+ private UserApi() {
+ this.apiClient = ApiClient.getInstance();
+ }
+
+ public static UserApi getInstance() {
+ return INSTANCE;
+ }
+
+ public List listUsers(String query) throws Exception {
+ String path = "/api/v1/users?page=0&size=1000";
+ if (query != null && !query.isEmpty()) {
+ path += "&q=" + query;
+ }
+ String response = apiClient.get(path, String.class);
+ return apiClient.getObjectMapper().readValue(response, new TypeReference>() {});
+ }
+
+ public UserResponse createUser(UserRequest request) throws Exception {
+ return apiClient.post("/api/v1/users", request, UserResponse.class);
+ }
+}