AccountResponse.java

package cz.vsb.crm.dto;

import cz.vsb.crm.model.Account;

import java.time.LocalDate;

public record AccountResponse(
        Long id,
        String companyName,
        String industry,
        String address,
        String phone,
        String email,
        String type,
        String contactName,
        String contactEmail,
        String contactPhone,
        String contactPosition,
        LocalDate deactivatedAt,
        boolean active) {

    public static AccountResponse from(Account account) {
        return new AccountResponse(
                account.getId(),
                account.getCompanyName(),
                account.getIndustry(),
                account.getAddress(),
                account.getPhone(),
                account.getEmail(),
                account.getType(),
                account.getContactName(),
                account.getContactEmail(),
                account.getContactPhone(),
                account.getContactPosition(),
                account.getDeactivatedAt(),
                account.isActive());
    }
}