package p.studio.workspaces.assets.metadata;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

public record AssetStudioGlyphMaterialSchema(
        String schemaId,
        AssetStudioGlyphMaterialSchemaStatus status,
        int version,
        Map<Integer, String> materialIndices,
        List<AssetStudioGlyphMaterialArtifactBinding> artifactBindings) {

    public AssetStudioGlyphMaterialSchema {
        schemaId = Objects.requireNonNull(schemaId, "schemaId").trim();
        status = Objects.requireNonNull(status, "status");
        if (schemaId.isBlank()) {
            throw new IllegalArgumentException("schemaId must not be blank");
        }
        if (version <= 0) {
            throw new IllegalArgumentException("version must be positive");
        }
        materialIndices = Map.copyOf(new LinkedHashMap<>(Objects.requireNonNull(materialIndices, "materialIndices")));
        artifactBindings = List.copyOf(Objects.requireNonNull(artifactBindings, "artifactBindings"));
    }
}
