package com.atlassian.stash.internal.comment;

/**
 * Defines query-ready type constants for all {@link InternalDiffCommentAnchor} subclasses. Each query-ready constant
 * is paired with a {@code String} version for use in {@code &#064;DiscriminatorValue} annotations.
 * <p>
 * The {@code &#064;DiscriminatorColumn} for {@link InternalDiffCommentAnchor} uses {@code INTEGER} type, so all of the
 * query constants are of {@code int} type. However, to support the fact that discriminators can be numbers or strings,
 * the {@code &#064;DiscriminatorValue} annotation accepts a {@code String}. As a result, all of the discriminator
 * constants are of {@code String} type.
 * <p>
 * When adding new types, please ensure the discriminator is built from the query-ready type, rather than hard-coding
 * a string with the same numeric value. Also, be aware that <i>changing</i> any constant after the fact requires the
 * creation of a Liquibase changeset to make the same update to any rows already in the database.
 *
 * @since 2.11
 */
public final class DiffCommentAnchorType {

    /**
     * {@code anchor_type} value for {@link com.atlassian.stash.internal.commit.InternalCommitDiscussionCommentAnchor
     * commit discussion comment anchors}.
     */
    public static final int COMMIT_DISCUSSION_TYPE = 2;
    /**
     * {@code anchor_type} value for {@link com.atlassian.stash.internal.pull.InternalPullRequestDiffCommentAnchor
     * pull request comment anchors}.
     */
    public static final int PULL_REQUEST_TYPE = 1;

    /**
     * {@code anchor_type} value for {@link com.atlassian.stash.internal.commit.InternalCommitDiscussionCommentAnchor
     * commit discussion comment anchors}, suitable for use in a {@code DiscriminatorValue} annotation.
     */
    public static final String COMMIT_DISCUSSION_DISCRIMINATOR = "" + COMMIT_DISCUSSION_TYPE;
    /**
     * {@code anchor_type} value for {@link com.atlassian.stash.internal.pull.InternalPullRequestDiffCommentAnchor
     * pull request comment anchors}, suitable for use in a {@code DiscriminatorValue} annotation.
     */
    public static final String PULL_REQUEST_DISCRIMINATOR = "" + PULL_REQUEST_TYPE;
}
