CREATE TYPE "repair_note_visibility" AS ENUM ('internal', 'customer');

CREATE TABLE "repair_note" (
  "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
  "repair_ticket_id" uuid NOT NULL REFERENCES "repair_ticket"("id"),
  "author_id" uuid NOT NULL REFERENCES "user"("id"),
  "author_name" varchar(255) NOT NULL,
  "content" text NOT NULL,
  "visibility" "repair_note_visibility" NOT NULL DEFAULT 'internal',
  "ticket_status" "repair_ticket_status",
  "created_at" timestamp with time zone NOT NULL DEFAULT now()
);
