CREATE TABLE files (
  id CHAR(36) PRIMARY KEY,            -- UUID
  filename VARCHAR(512),
  size BIGINT,
  num_parts INT,
  upload_at DATETIME,
  expires_at DATETIME,
  token_hash CHAR(64),                -- pl. SHA256(token)
  encrypted_key VARBINARY(512),       -- opcionális: ha szerver old. titkosít egy kulcsot
  deleted TINYINT(1) DEFAULT 0
);

CREATE TABLE file_parts (
  id INT AUTO_INCREMENT PRIMARY KEY,
  file_id CHAR(36),
  part_index INT,
  discord_message_id VARCHAR(64),     -- üzenet id, vagy webhook meta
  discord_attachment_url VARCHAR(1024),
  size INT,
  checksum CHAR(64),
  FOREIGN KEY (file_id) REFERENCES files(id)
);
