UserStopword.java

/*
 * Copyright © 2024-2025 The CTAN Team and individual authors
 *
 * This file is distributed under the 3-clause BSD license.
 * See file LICENSE for details.
 */

package org.ctan.site.domain.account;

import org.ctan.site.domain.AbstractEntity;

import com.google.common.collect.ImmutableMap;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * The domain class <code>UserStopword</code> contains the description of a
 * forbidden user account name on the site.
 *
 * @author <a href="mailto:gene@ctan.org">Gerd Neugebauer</a>
 */
@Entity
@Table(name = "user_blacklist")
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class UserStopword extends AbstractEntity {

    /**
     * The field <code>stopword</code> contains the forbidden word.
     */
    @Column(length = 255, name = "stopword")
    private String stopword;

    /**
     * The method <code>toMap</code> provides means to get the instance as an
     * immutable Map.
     *
     * @return the Map
     */
    public ImmutableMap<String, Object> toMap() {

        return ImmutableMap.of("id", (Object) getId(),
            "stopword", stopword);
    }
}