package com.l7tech.gateway.common.service;

import com.l7tech.objectmodel.Alias;
import com.l7tech.objectmodel.EntityType;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.SecurityZone;
import com.l7tech.objectmodel.folder.Folder;
import com.l7tech.objectmodel.migration.Migration;
import com.l7tech.objectmodel.migration.MigrationMappingSelection;
import com.l7tech.objectmodel.migration.PropertyResolver.Type;
import com.l7tech.search.Dependency;
import com.l7tech.search.Dependency.DependencyType;
import com.l7tech.search.Dependency.MethodReturnType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlTransient;
import org.hibernate.annotations.Proxy;
import org.jetbrains.annotations.Nullable;

@XmlRootElement
@Entity
@Proxy(lazy = false)
@Table(name = "published_service_alias")
public class PublishedServiceAlias extends Alias<PublishedService> {
   static final long serialVersionUID = 1293410418970576075L;

   @Deprecated
   protected PublishedServiceAlias() {
   }

   public PublishedServiceAlias(PublishedService var1, Folder var2) {
      super(
         var1,
         var2,
         var1 == null
            ? null
            : (var1.getSecurityZone() != null && var1.getSecurityZone().permitsEntityType(EntityType.SERVICE_ALIAS) ? var1.getSecurityZone() : null)
      );
   }

   public PublishedServiceAlias(ServiceHeader var1, Folder var2, @Nullable SecurityZone var3) {
      super(var1.getGoid(), var2, var3);
   }

   @XmlTransient
   @Transient
   public EntityType getEntityType() {
      return EntityType.SERVICE;
   }

   @Dependency(type = DependencyType.SERVICE, methodReturnType = MethodReturnType.GOID)
   @Migration(mapName = MigrationMappingSelection.NONE, mapValue = MigrationMappingSelection.NONE, resolver = Type.SERVICE_ALIAS)
   @Column(name = "published_service_goid")
   @org.hibernate.annotations.Type(type = "com.l7tech.server.util.GoidType")
   public Goid getEntityGoid() {
      return this.entityGoid;
   }

   @Deprecated
   public void setEntityGoid(Goid var1) {
      super.setEntityGoid(var1);
   }
}
