package de.dhbwstuttgart.syntaxtree.type;

import de.dhbwstuttgart.parser.NullToken;
import de.dhbwstuttgart.server.packet.dataContainers.ISerializableData;
import de.dhbwstuttgart.server.packet.dataContainers.KeyStorage;
import de.dhbwstuttgart.server.packet.dataContainers.serialized.ISerialNode;
import de.dhbwstuttgart.server.packet.dataContainers.serialized.SerialMap;
import de.dhbwstuttgart.typeinference.unify.UnifyContext;
import org.antlr.v4.runtime.Token;

import de.dhbwstuttgart.parser.scope.JavaClassName;


public class Void extends RefType implements ISerializableData
{
    public Void(Token offset) {
        super(JavaClassName.Void, offset);
    }

    @Override
    public ISerialNode toSerial(KeyStorage keyStorage) {
        // create the wrapper and put this as the object
        var serializedWrapper = super.toSerial(keyStorage).assertType(SerialMap.class);
        serializedWrapper.put("object", new SerialMap());
        return serializedWrapper;
    }

    public static Void fromSerial(SerialMap data, UnifyContext context) {
        return new Void(new NullToken());
    }
}

