package com.social.media.dto;

import jakarta.validation.constraints.*;

import java.time.LocalDateTime;
import java.util.Map;

public class UserDto {
    
    private Long id;
    private String userCode;
    
    @NotNull(message = "Company ID é obrigatório")
    private Long companyId;
    
    private Long parentUserId;
    
    @NotBlank(message = "Nome é obrigatório")
    @Size(max = 255, message = "Nome deve ter no máximo 255 caracteres")
    private String name;
    
    @NotBlank(message = "Email é obrigatório")
    @Email(message = "Email deve ter formato válido")
    @Size(max = 320, message = "Email deve ter no máximo 320 caracteres")
    private String email;
    
    @Pattern(regexp = "^[0-9]{11}$|^$", message = "CPF deve ter 11 dígitos")
    private String cpf;
    
    @Size(max = 20, message = "Telefone deve ter no máximo 20 caracteres")
    private String phone;
    
    @Size(max = 1000, message = "Avatar URL deve ter no máximo 1000 caracteres")
    private String avatarUrl;
    
    @Size(max = 100, message = "Posição deve ter no máximo 100 caracteres")
    private String position;
    
    @Size(max = 100, message = "Departamento deve ter no máximo 100 caracteres")
    private String department;
    
    private String type;
    private String status;
    private Map<String, Object> configuration;
    private Boolean whatsappEnabled;
    private Boolean profileVerified;
    private Long managerId;
    
    @Min(value = 0, message = "Nível organizacional deve ser no mínimo 0")
    @Max(value = 10, message = "Nível organizacional deve ser no máximo 10")
    private Integer organizationalLevel;
    
    @Pattern(regexp = "^[A-Za-z_/]+$", message = "Timezone deve ter formato válido")
    @Size(max = 50, message = "Timezone deve ter no máximo 50 caracteres")
    private String timezone;
    
    @Pattern(regexp = "^[a-z]{2}(-[A-Z]{2})?$", message = "Language deve ter formato válido (ex: pt-BR)")
    @Size(max = 10, message = "Language deve ter no máximo 10 caracteres")
    private String language;
    
    private LocalDateTime registrationDate;
    private LocalDateTime lastAccessDate;
    private Boolean deleted;
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;
    
    public UserDto() {}
    
    public UserDto(Long id, String name, String email, Long companyId) {
        this.id = id;
        this.name = name;
        this.email = email;
        this.companyId = companyId;
        this.createdAt = LocalDateTime.now();
    }
    
    // Getters e Setters
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }
    
    public String getUserCode() { return userCode; }
    public void setUserCode(String userCode) { this.userCode = userCode; }
    
    public Long getCompanyId() { return companyId; }
    public void setCompanyId(Long companyId) { this.companyId = companyId; }
    
    public Long getParentUserId() { return parentUserId; }
    public void setParentUserId(Long parentUserId) { this.parentUserId = parentUserId; }
    
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    
    public String getEmail() { return email; }
    public void setEmail(String email) { this.email = email; }
    
    public String getCpf() { return cpf; }
    public void setCpf(String cpf) { this.cpf = cpf; }
    
    public String getPhone() { return phone; }
    public void setPhone(String phone) { this.phone = phone; }
    
    public String getAvatarUrl() { return avatarUrl; }
    public void setAvatarUrl(String avatarUrl) { this.avatarUrl = avatarUrl; }
    
    public String getPosition() { return position; }
    public void setPosition(String position) { this.position = position; }
    
    public String getDepartment() { return department; }
    public void setDepartment(String department) { this.department = department; }
    
    public String getType() { return type; }
    public void setType(String type) { this.type = type; }
    
    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }
    
    public Map<String, Object> getConfiguration() { return configuration; }
    public void setConfiguration(Map<String, Object> configuration) { this.configuration = configuration; }
    
    public Boolean getWhatsappEnabled() { return whatsappEnabled; }
    public void setWhatsappEnabled(Boolean whatsappEnabled) { this.whatsappEnabled = whatsappEnabled; }
    
    public Boolean getProfileVerified() { return profileVerified; }
    public void setProfileVerified(Boolean profileVerified) { this.profileVerified = profileVerified; }
    
    public Long getManagerId() { return managerId; }
    public void setManagerId(Long managerId) { this.managerId = managerId; }
    
    public Integer getOrganizationalLevel() { return organizationalLevel; }
    public void setOrganizationalLevel(Integer organizationalLevel) { this.organizationalLevel = organizationalLevel; }
    
    public String getTimezone() { return timezone; }
    public void setTimezone(String timezone) { this.timezone = timezone; }
    
    public String getLanguage() { return language; }
    public void setLanguage(String language) { this.language = language; }
    
    public LocalDateTime getRegistrationDate() { return registrationDate; }
    public void setRegistrationDate(LocalDateTime registrationDate) { this.registrationDate = registrationDate; }
    
    public LocalDateTime getLastAccessDate() { return lastAccessDate; }
    public void setLastAccessDate(LocalDateTime lastAccessDate) { this.lastAccessDate = lastAccessDate; }
    
    public Boolean getDeleted() { return deleted; }
    public void setDeleted(Boolean deleted) { this.deleted = deleted; }
    
    public LocalDateTime getCreatedAt() { return createdAt; }
    public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
    
    public LocalDateTime getUpdatedAt() { return updatedAt; }
    public void setUpdatedAt(LocalDateTime updatedAt) { this.updatedAt = updatedAt; }
}
