package com.qqchen.deploy.backend.deploy.entity;


import com.fasterxml.jackson.databind.JsonNode;
import com.qqchen.deploy.backend.deploy.enums.BuildTypeEnum;
import com.qqchen.deploy.backend.deploy.enums.DevelopmentLanguageTypeEnum;
import com.qqchen.deploy.backend.framework.annotation.LogicDelete;
import com.qqchen.deploy.backend.framework.domain.Entity;
import com.vladmihalcea.hibernate.type.json.JsonType;
import jakarta.persistence.Column;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Type;

@Data
@EqualsAndHashCode(callSuper = true)
@jakarta.persistence.Entity
@Table(name = "deploy_app_config")
public class DeployAppConfig extends Entity<Long> {

    @Column(name = "build_type", nullable = false)
    @Enumerated(EnumType.STRING)
    private BuildTypeEnum buildType;

    @Column(name = "language_type", nullable = false)
    @Enumerated(EnumType.STRING)
    private DevelopmentLanguageTypeEnum languageType;

    @Type(JsonType.class)
    @Column(name = "form_variables_schema", columnDefinition = "text")
    private JsonNode formVariablesSchema;

    @Type(JsonType.class)
    @Column(name = "build_variables", columnDefinition = "text", nullable = false)
    private JsonNode buildVariables;

    @Column(name = "environment_id", nullable = false)
    private Long environmentId;

    @Column(name = "application_id", nullable = false)
    private Long applicationId;

    @Column(name = "workflow_definition_id", nullable = false)
    private Long workflowDefinitionId;

    @Column(name = "enabled", nullable = false)
    private Boolean enabled;
}
