package mx.gob.slp.baseadminweb.web.dto;

import mx.gob.slp.baseadminweb.domain.model.PassCode;

import java.time.Instant;

public record PassCodeListItem(
        Long id,
        String name,
        String code,
        Instant createdAt,
        String status,
        boolean scanned,
        Instant scannedAt
) {

    public static PassCodeListItem from(PassCode passCode) {
        return new PassCodeListItem(
                passCode.getId(),
                passCode.getName(),
                passCode.getCode(),
                passCode.getCreatedAt(),
                passCode.getStatus().name(),
                passCode.isScanned(),
                passCode.getScannedAt()
        );
    }
}