package com.vaessl.app.connection;

import com.fasterxml.jackson.annotation.JsonProperty;

import jakarta.validation.constraints.NotBlank;

public record ConnectionRequest(@NotBlank(message = "App URL is mandatory") String appUrl,
                @NotBlank(message = "Service type is mandatory") String serviceType,
                String username, String password, String apiKey,
                @JsonProperty(defaultValue = "false") Boolean stayLoggedIn) {

        public ConnectionRequest {
                if (stayLoggedIn == null) {
                        stayLoggedIn = false;
                }
        }

        public ConnectionRequest(String appUrl, String serviceType, String username,
                        String password, Boolean stayLoggedIn) {
                this(appUrl, serviceType, username, password, null, stayLoggedIn);
        }
}
