package com.evseminar.dto;

import com.evseminar.model.Customer;
import lombok.Data;
import lombok.Builder;

@Data
@Builder
public class CustomerDTO {
    private Long customerId;
    private String name;
    private String email;
    private String telephone;
    private String customerType;
    private String companyName;
    private Boolean emailVerified;
    private String role;
    private java.time.LocalDateTime lastLoginAt;

    public static CustomerDTO from(Customer customer) {
        return CustomerDTO.builder()
                .customerId(customer.getCustomerId())
                .name(customer.getName())
                .email(customer.getEmail())
                .telephone(customer.getTelephone())
                .customerType(customer.getCustomerType().name())
                .companyName(customer.getCompanyName())
                .emailVerified(customer.getEmailVerified())
                .role(customer.getRole() != null ? customer.getRole().name() : "USER")
                .lastLoginAt(customer.getLastLoginAt())
                .build();
    }
}
