CREATE TABLE reservation_guests (
  idReservation           INT             NOT NULL,
  idEntityCompany         INT             NOT NULL,
  guest_index             TINYINT UNSIGNED NOT NULL,     -- posição no array
  idEntity                INT             NULL,
  name                    VARCHAR(255)    NULL,
  idRoom                  INT             NULL,
  contactMail             VARCHAR(255)    NULL,
  contactPhone            VARCHAR(50)     NULL,
  main                    TINYINT(1)      NULL,
  federalRegistrationNumber VARCHAR(50)   NULL,
  documentType            TINYINT         NULL,
  gender                  TINYINT         NULL,
  birthDate               DATE            NULL,
  mainDocType             TINYINT         NULL,
  docCpfCnpjPassport      VARCHAR(100)    NULL,
  addressZipCode          VARCHAR(20)     NULL,
  addressCountry          VARCHAR(100)    NULL,
  addressStateCode        VARCHAR(10)     NULL,
  addressStateName        VARCHAR(100)    NULL,
  addressCity             VARCHAR(100)    NULL,
  addressNeighborhood     VARCHAR(100)    NULL,
  addressAddress          VARCHAR(255)    NULL,
  addressDetails          VARCHAR(255)    NULL,
  addressNumber           VARCHAR(20)     NULL,
  PRIMARY KEY (idReservation, idEntityCompany, guest_index),
  FOREIGN KEY (idReservation, idEntityCompany)
    REFERENCES reservation_details(idReservation, idEntityCompany)
    ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
