package net.siegeln.cameleer.saas.tenant.dto;

import net.siegeln.cameleer.saas.tenant.TenantEntity;

import java.time.Instant;
import java.util.UUID;

public record TenantResponse(
        UUID id,
        String name,
        String slug,
        String tier,
        String status,
        String serverEndpoint,
        String provisionError,
        Instant createdAt,
        Instant updatedAt
) {
    public static TenantResponse from(TenantEntity e) {
        return new TenantResponse(
            e.getId(), e.getName(), e.getSlug(),
            e.getTier().name(), e.getStatus().name(),
            e.getServerEndpoint(), e.getProvisionError(),
            e.getCreatedAt(), e.getUpdatedAt()
        );
    }
}
