package pl.polskalokalnie.lead;

import java.time.Instant;
import java.util.List;

public record LeadResponse(
        Long id,
        String name,
        String email,
        String phone,
        String city,
        LeadSource source,
        Long userId,
        LeadStatus status,
        List<String> tags,
        boolean emailConsent,
        boolean smsConsent,
        boolean emailOptOut,
        boolean smsOptOut,
        String notes,
        Instant createdAt
) {
    public static LeadResponse from(Lead lead) {
        return new LeadResponse(
                lead.getId(),
                lead.getName(),
                lead.getEmail(),
                lead.getPhone(),
                lead.getCity(),
                lead.getSource(),
                lead.getUserId(),
                lead.getStatus(),
                List.copyOf(lead.getTags()),
                lead.isEmailConsent(),
                lead.isSmsConsent(),
                lead.isEmailOptOut(),
                lead.isSmsOptOut(),
                lead.getNotes(),
                lead.getCreatedAt()
        );
    }
}
