package org.dbsp.sqlCompiler.ir.type.user;

import com.fasterxml.jackson.databind.JsonNode;
import org.dbsp.sqlCompiler.compiler.backend.JsonDecoder;
import org.dbsp.sqlCompiler.compiler.frontend.calciteObject.CalciteObject;
import org.dbsp.sqlCompiler.ir.expression.DBSPExpression;
import org.dbsp.sqlCompiler.ir.type.DBSPTypeCode;

/** Represents the DBSP ZWeight type as TypeUser. */
public final class DBSPTypeWeight extends DBSPTypeUser {
    public static final DBSPTypeWeight INSTANCE = new DBSPTypeWeight();

    public DBSPExpression zero() {
        return INSTANCE.constructor("zero");
    }

    public DBSPExpression one() {
        return INSTANCE.constructor("one");
    }

    private DBSPTypeWeight() {
        super(CalciteObject.EMPTY, DBSPTypeCode.USER, "Weight", false);
    }

    public static String makeWeight(long value) {
        return value + "i64";
    }

    // sameType and hashCode inherited from TypeUser.

    @SuppressWarnings("unused")
    public static DBSPTypeWeight fromJson(JsonNode node, JsonDecoder decoder) {
        return INSTANCE;
    }
}
