/**
 * Copyright (c) 2020-present, Goldman Sachs
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { DataType } from './DataType.js';
import { PRECISE_PRIMITIVE_TYPE, PRIMITIVE_TYPE, } from '../../../../MetaModelConst.js';
import { extractElementNameFromPath } from '../../../../MetaModelUtils.js';
export class PrimitiveType extends DataType {
    accept_PackageableElementVisitor(visitor) {
        return visitor.visit_PrimitiveType(this);
    }
    static STRING = new PrimitiveType(PRIMITIVE_TYPE.STRING);
    static BOOLEAN = new PrimitiveType(PRIMITIVE_TYPE.BOOLEAN);
    static BINARY = new PrimitiveType(PRIMITIVE_TYPE.BINARY);
    static NUMBER = new PrimitiveType(PRIMITIVE_TYPE.NUMBER);
    static INTEGER = new PrimitiveType(PRIMITIVE_TYPE.INTEGER);
    static FLOAT = new PrimitiveType(PRIMITIVE_TYPE.FLOAT);
    static DECIMAL = new PrimitiveType(PRIMITIVE_TYPE.DECIMAL);
    static DATE = new PrimitiveType(PRIMITIVE_TYPE.DATE);
    static STRICTDATE = new PrimitiveType(PRIMITIVE_TYPE.STRICTDATE);
    static DATETIME = new PrimitiveType(PRIMITIVE_TYPE.DATETIME);
    static STRICTTIME = new PrimitiveType(PRIMITIVE_TYPE.STRICTTIME);
    static LATESTDATE = new PrimitiveType(PRIMITIVE_TYPE.LATESTDATE);
    static BYTE = new PrimitiveType(PRIMITIVE_TYPE.BYTE);
}
export class PrecisePrimitiveType extends DataType {
    static VARCHAR = new PrecisePrimitiveType(extractElementNameFromPath(PRECISE_PRIMITIVE_TYPE.VARCHAR));
    static INT = new PrecisePrimitiveType(extractElementNameFromPath(PRECISE_PRIMITIVE_TYPE.INT));
    static TINY_INT = new PrecisePrimitiveType(extractElementNameFromPath(PRECISE_PRIMITIVE_TYPE.TINY_INT));
    static U_TINY_INT = new PrecisePrimitiveType(extractElementNameFromPath(PRECISE_PRIMITIVE_TYPE.U_TINY_INT));
    static SMALL_INT = new PrecisePrimitiveType(extractElementNameFromPath(PRECISE_PRIMITIVE_TYPE.SMALL_INT));
    static U_SMALL_INT = new PrecisePrimitiveType(extractElementNameFromPath(PRECISE_PRIMITIVE_TYPE.U_SMALL_INT));
    static U_INT = new PrecisePrimitiveType(extractElementNameFromPath(PRECISE_PRIMITIVE_TYPE.U_INT));
    static BIG_INT = new PrecisePrimitiveType(extractElementNameFromPath(PRECISE_PRIMITIVE_TYPE.BIG_INT));
    static U_BIG_INT = new PrecisePrimitiveType(extractElementNameFromPath(PRECISE_PRIMITIVE_TYPE.U_BIG_INT));
    static FLOAT = new PrecisePrimitiveType(extractElementNameFromPath(PRECISE_PRIMITIVE_TYPE.FLOAT));
    static DOUBLE = new PrecisePrimitiveType(extractElementNameFromPath(PRECISE_PRIMITIVE_TYPE.DOUBLE));
    static NUMERIC = new PrecisePrimitiveType(extractElementNameFromPath(PRECISE_PRIMITIVE_TYPE.NUMERIC));
    static TIMESTAMP = new PrecisePrimitiveType(extractElementNameFromPath(PRECISE_PRIMITIVE_TYPE.TIMESTAMP));
    accept_PackageableElementVisitor(visitor) {
        throw new Error('Method not implemented.');
    }
}
export const getPrimitiveTypeInstanceFromEnum = (type) => {
    switch (type) {
        case PRIMITIVE_TYPE.STRING:
            return PrimitiveType.STRING;
        case PRIMITIVE_TYPE.BOOLEAN:
            return PrimitiveType.BOOLEAN;
        case PRIMITIVE_TYPE.BINARY:
            return PrimitiveType.BINARY;
        case PRIMITIVE_TYPE.NUMBER:
            return PrimitiveType.NUMBER;
        case PRIMITIVE_TYPE.INTEGER:
            return PrimitiveType.INTEGER;
        case PRIMITIVE_TYPE.FLOAT:
            return PrimitiveType.FLOAT;
        case PRIMITIVE_TYPE.DECIMAL:
            return PrimitiveType.DECIMAL;
        case PRIMITIVE_TYPE.DATE:
            return PrimitiveType.DATE;
        case PRIMITIVE_TYPE.STRICTDATE:
            return PrimitiveType.STRICTDATE;
        case PRIMITIVE_TYPE.DATETIME:
            return PrimitiveType.DATETIME;
        case PRIMITIVE_TYPE.STRICTTIME:
            return PrimitiveType.STRICTTIME;
        case PRIMITIVE_TYPE.LATESTDATE:
            return PrimitiveType.LATESTDATE;
        case PRIMITIVE_TYPE.BYTE:
            return PrimitiveType.BYTE;
        default:
            throw new Error(`Unable to get PrimitiveType class for type ${type}`);
    }
};
//# sourceMappingURL=PrimitiveType.js.map