package org.marsik.elshelves.api.entities;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.marsik.elshelves.ember.EmberModel;

@Data
@NoArgsConstructor
@EqualsAndHashCode(of = {}, callSuper = true)
public class PolymorphicRecord extends AbstractEntityApiModel {
    String type;

    public static PolymorphicRecord build(AbstractEntityApiModel entity) {
        PolymorphicRecord p = new PolymorphicRecord();
        p.setType(EmberModel.getSingularName(entity.getClass()));
        p.setId(entity.getId());
        return p;
    }
}

@@ -170,16 +170,40 @@
 Model;%0A%0A
+import java.util.UUID;%0A%0A
 @Data%0A@N
@@ -347,16 +347,175 @@
  type;%0A%0A
+    public PolymorphicRecord(UUID uuid) %7B%0A        super(uuid);%0A    %7D%0A%0A    public PolymorphicRecord(String uuid) %7B%0A        super(UUID.fromString(uuid));%0A    %7D%0A%0A
     publ

Fix updates of entities with polymorphic records