package de.dhbwstuttgart.target.tree.expression;

import de.dhbwstuttgart.target.tree.type.TargetType;

public sealed interface TargetLiteral extends TargetExpression {
    Object value();

    record BooleanLiteral(Boolean value) implements TargetLiteral {
        @Override
        public TargetType type() {
            return TargetType.boolean_;
        }
    }

    record CharLiteral(Character value) implements TargetLiteral {
        @Override
        public TargetType type() {
            return TargetType.char_;
        }
    }

    record IntLiteral(Integer value) implements TargetLiteral {
        @Override
        public TargetType type() {
            return TargetType.int_;
        }
    }

    record LongLiteral(Long value) implements TargetLiteral {
        @Override
        public TargetType type() {
            return TargetType.long_;
        }
    }

    record FloatLiteral(Float value) implements TargetLiteral {
        @Override
        public TargetType type() {
            return TargetType.float_;
        }
    }

    record DoubleLiteral(Double value) implements TargetLiteral {
        @Override
        public TargetType type() {
            return TargetType.double_;
        }
    }

    record StringLiteral(String value) implements TargetLiteral {
        @Override
        public TargetType type() {
            return TargetType.String;
        }
    }

    record Null() implements TargetLiteral {
        @Override
        public TargetType type() {
            return TargetType.Object;
        }

        @Override
        public Object value() {
            return null;
        }
    }
}
