-- +goose Up
CREATE TYPE file_type AS ENUM ('vector_with_table', 'vector', 'raster');
CREATE TYPE file_validation_status AS ENUM ('pending', 'valid', 'failed');

CREATE TABLE files (
    id                UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    filename          VARCHAR(255) NOT NULL,
    storage_key       TEXT NOT NULL,
    file_type         file_type NOT NULL,
    validation_status file_validation_status NOT NULL DEFAULT 'pending',
    validation_error  TEXT,
    kato_column       VARCHAR(255),
    crs               VARCHAR(64),
    feature_count     INTEGER,
    uploaded_at       TIMESTAMP NOT NULL DEFAULT now(),
    updated_at        TIMESTAMP NOT NULL DEFAULT now()
);

-- +goose Down
DROP TABLE files;
DROP TYPE file_validation_status;
DROP TYPE file_type;
