-- Catalogue objects (the inventory-minimum core). One row = one object or a group.
CREATE TABLE object (
    id                UUID PRIMARY KEY,
    object_number     TEXT NOT NULL UNIQUE,
    object_name       TEXT NOT NULL,
    number_of_objects INTEGER NOT NULL DEFAULT 1 CHECK (number_of_objects >= 1),
    brief_description TEXT,
    current_location  TEXT,
    current_owner     TEXT,
    recorder          TEXT,
    recording_date    DATE,
    visibility        TEXT NOT NULL DEFAULT 'draft'
                          CHECK (visibility IN ('draft', 'internal', 'public')),
    created_at        TIMESTAMPTZ NOT NULL DEFAULT now(),
    updated_at        TIMESTAMPTZ NOT NULL DEFAULT now()
);

CREATE INDEX object_visibility_idx ON object (visibility);
