001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.data.osm.pbf;
003
004import jakarta.annotation.Nullable;
005
006/**
007 * Optional metadata for primitives
008 * @since 18695
009 */
010public final class Info {
011    private final int version;
012    private final Long timestamp;
013    private final Long changeset;
014    private final Integer uid;
015    private final Integer userSid;
016    private final boolean visible;
017
018    /**
019     * Create a new {@link Info} object
020     * @param version The OSM version
021     * @param timestamp The OSM timestamp
022     * @param changeset The OSM changeset
023     * @param uid The user ID
024     * @param userSid The string id for the user name
025     * @param visible {@code false} if the element was deleted for this version
026     */
027    public Info(int version, @Nullable Long timestamp, @Nullable Long changeset, @Nullable Integer uid, @Nullable Integer userSid,
028                boolean visible) {
029        this.version = version;
030        this.timestamp = timestamp;
031        this.changeset = changeset;
032        this.uid = uid;
033        this.userSid = userSid;
034        this.visible = visible;
035    }
036
037    /**
038     * Get the OSM version
039     * @return The version
040     */
041    public int version() {
042        return this.version;
043    }
044
045    /**
046     * Get the OSM timestamp
047     * @return The timestamp
048     */
049    public Long timestamp() {
050        return this.timestamp;
051    }
052
053    /**
054     * Get the OSM changeset
055     * @return The changeset
056     */
057    public Long changeset() {
058        return this.changeset;
059    }
060
061    /**
062     * Get the OSM user id
063     * @return The user id
064     */
065    public Integer uid() {
066        return this.uid;
067    }
068
069    /**
070     * Get the id for the username in the PBF
071     * @return The user string id (in PBF strings)
072     */
073    public Integer userSid() {
074        return this.userSid;
075    }
076
077    /**
078     * Get the visibility of the object
079     * @return {@code false} if the object was deleted
080     */
081    public boolean isVisible() {
082        return this.visible;
083    }
084}