import type { DataTypeData } from './data-types';

export const postgresDataTypes: readonly DataTypeData[] = [
    // Level 1 - Most commonly used types
    { name: 'integer', id: 'integer', usageLevel: 1 },
    {
        name: 'varchar',
        id: 'varchar',
        fieldAttributes: { hasCharMaxLength: true },
        usageLevel: 1,
    },
    { name: 'text', id: 'text', usageLevel: 1 },
    { name: 'boolean', id: 'boolean', usageLevel: 1 },
    { name: 'timestamp', id: 'timestamp', usageLevel: 1 },
    { name: 'date', id: 'date', usageLevel: 1 },

    // Level 2 - Second most common types
    { name: 'bigint', id: 'bigint', usageLevel: 2 },
    {
        name: 'decimal',
        id: 'decimal',
        usageLevel: 2,
        fieldAttributes: {
            precision: {
                max: 131072,
                min: 0,
                default: 10,
            },
            scale: {
                max: 16383,
                min: 0,
                default: 2,
            },
        },
    },
    { name: 'serial', id: 'serial', usageLevel: 2 },
    { name: 'json', id: 'json', usageLevel: 2 },
    { name: 'jsonb', id: 'jsonb', usageLevel: 2 },
    { name: 'uuid', id: 'uuid', usageLevel: 2 },
    {
        name: 'timestamp with time zone',
        id: 'timestamp_with_time_zone',
        usageLevel: 2,
    },

    // Less common types
    {
        name: 'numeric',
        id: 'numeric',
        fieldAttributes: {
            precision: {
                max: 131072,
                min: 0,
                default: 10,
            },
            scale: {
                max: 16383,
                min: 0,
                default: 2,
            },
        },
    },
    { name: 'real', id: 'real' },
    { name: 'double precision', id: 'double_precision' },
    { name: 'smallserial', id: 'smallserial' },
    { name: 'bigserial', id: 'bigserial' },
    { name: 'money', id: 'money' },
    { name: 'smallint', id: 'smallint' },
    { name: 'char', id: 'char', fieldAttributes: { hasCharMaxLength: true } },
    {
        name: 'character varying',
        id: 'character_varying',
        fieldAttributes: { hasCharMaxLength: true },
    },
    { name: 'time', id: 'time' },
    { name: 'timestamp without time zone', id: 'timestamp_without_time_zone' },
    { name: 'time with time zone', id: 'time_with_time_zone' },
    { name: 'time without time zone', id: 'time_without_time_zone' },
    { name: 'interval', id: 'interval' },
    { name: 'bytea', id: 'bytea' },
    { name: 'enum', id: 'enum' },
    { name: 'point', id: 'point' },
    { name: 'line', id: 'line' },
    { name: 'lseg', id: 'lseg' },
    { name: 'box', id: 'box' },
    { name: 'path', id: 'path' },
    { name: 'polygon', id: 'polygon' },
    { name: 'circle', id: 'circle' },
    { name: 'cidr', id: 'cidr' },
    { name: 'inet', id: 'inet' },
    { name: 'macaddr', id: 'macaddr' },
    { name: 'macaddr8', id: 'macaddr8' },
    { name: 'bit', id: 'bit' },
    { name: 'bit varying', id: 'bit_varying' },
    { name: 'tsvector', id: 'tsvector' },
    { name: 'tsquery', id: 'tsquery' },
    { name: 'xml', id: 'xml' },
    { name: 'array', id: 'array' },
    { name: 'int4range', id: 'int4range' },
    { name: 'int8range', id: 'int8range' },
    { name: 'numrange', id: 'numrange' },
    { name: 'tsrange', id: 'tsrange' },
    { name: 'tstzrange', id: 'tstzrange' },
    { name: 'daterange', id: 'daterange' },
    { name: 'oid', id: 'oid' },
    { name: 'regproc', id: 'regproc' },
    { name: 'regprocedure', id: 'regprocedure' },
    { name: 'regoper', id: 'regoper' },
    { name: 'regoperator', id: 'regoperator' },
    { name: 'regclass', id: 'regclass' },
    { name: 'regtype', id: 'regtype' },
    { name: 'regrole', id: 'regrole' },
    { name: 'regnamespace', id: 'regnamespace' },
    { name: 'regconfig', id: 'regconfig' },
    { name: 'regdictionary', id: 'regdictionary' },
    { name: 'user-defined', id: 'user-defined' },
] as const;
