/*
 *   This file is a part of the SteamWar software.
 *
 *   Copyright (C) 2026 SteamWar.de-Serverteam
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Affero General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *   GNU Affero General Public License for more details.
 *
 *   You should have received a copy of the GNU Affero General Public License
 *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

package de.steamwar;

/**
 * A single parsed line from a .accesswidener file.
 * <p>
 * Examples:
 * accessible class  net/minecraft/server/level/ServerPlayer
 * accessible method net/minecraft/server/level/ServerPlayer getStats ()V
 * mutable    field  net/minecraft/world/entity/Entity id I
 * extendable class  net/minecraft/world/level/chunk/LevelChunk
 */
public record AccessWidenerEntry(
        /** accessible | mutable | extendable (may have "transitive-" prefix) */
        String directive,
        /** class | method | field */
        String memberType,
        /** Internal class name, e.g. net/minecraft/server/level/ServerPlayer */
        String target,
        /** Method/field name, null for class entries */
        String name,
        /** Descriptor, null for class entries */
        String descriptor) {
    /**
     * Returns true if this entry targets the class with the given internal name.
     */
    public boolean targets(String internalName) {
        return target.equals(internalName);
    }
}

