package io.github.shirainbown.sharelink.model;

import java.time.Instant;
import lombok.Data;
import lombok.EqualsAndHashCode;
import run.halo.app.extension.AbstractExtension;
import run.halo.app.extension.GVK;

/**
 * Registry entry for an email address that has passed download email verification. The
 * metadata name is the SHA-256 hex of the normalized email, which keeps it unique and
 * stable across verifications.
 */
@GVK(group = "sharelink.halo.run", version = "v1alpha1", kind = "VerifiedDownloader",
    plural = "verifieddownloaders", singular = "verifieddownloader")
@Data
@EqualsAndHashCode(callSuper = true)
public class VerifiedDownloader extends AbstractExtension {

    private Spec spec;

    @Data
    public static class Spec {

        /**
         * The normalized (trimmed, lower-cased) email address.
         */
        private String email;

        private Instant firstVerifiedAt;

        private Instant lastVerifiedAt;
    }
}
