module.exports = function(sequelize, DataTypes) {
  return sequelize.define(
    "coaching_audit_events",
    {
      id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true },
      event_type: { type: DataTypes.STRING(64), allowNull: false },
      actorId: { type: DataTypes.UUID },
      target_type: { type: DataTypes.STRING(32), allowNull: false },
      target_id: { type: DataTypes.UUID },
      metadata: { type: DataTypes.JSONB, allowNull: false, defaultValue: {} },
    },
    { timestamps: true, freezeTableName: true },
  );
};
