package dev.photosync.core.provider;

import java.time.LocalDate;

/**
 * A month of the remote timeline, and how many assets are in it.
 *
 * <p>This is the whole trick behind the virtual list: the backend hands us every
 * bucket's <em>count</em> in one cheap call, so the scrollbar and the total
 * height are exact before a single asset has been fetched. Pages are then loaded
 * only for the months the viewport actually reaches.
 *
 * <p>{@code key} is the backend's own opaque token for the bucket and is passed
 * straight back when requesting its page; {@code month} is the parsed form the
 * UI sorts and labels with.
 */
public record TimelineBucket(String key, LocalDate month, int assetCount) implements Comparable<TimelineBucket> {

    /** Newest first, matching how the timeline is displayed. */
    @Override
    public int compareTo(TimelineBucket other) {
        return other.month.compareTo(month);
    }
}
