package com.atlassian.bitbucket.internal.branch.model.dao;

import net.java.ao.Accessor;
import net.java.ao.Mutator;
import net.java.ao.Preload;
import net.java.ao.RawEntity;
import net.java.ao.schema.NotNull;
import net.java.ao.schema.PrimaryKey;
import net.java.ao.schema.StringLength;
import net.java.ao.schema.Table;

import javax.annotation.Nonnull;

/**
 * AO entity to store the branch model association with a repository.
 *
 * @since 2.8
 */
@Table("BRANCH_MODEL")
@Preload
public interface AoBranchModelConfiguration extends RawEntity<Integer> {

    String REPOSITORY_ID_COLUMN = "REPOSITORY_ID";
    String ENABLED_COLUMN = "IS_ENABLED";

    String DEVELOPMENT_BRANCH_REF_ID_COLUMN = "DEV_ID";
    String DEVELOPMENT_BRANCH_USE_DEFAULT_COLUMN = "DEV_USE_DEFAULT";

    String PRODUCTION_BRANCH_REF_ID_COLUMN = "PROD_ID";
    String PRODUCTION_BRANCH_USE_DEFAULT_COLUMN = "PROD_USE_DEFAULT";

    @NotNull
    @PrimaryKey(REPOSITORY_ID_COLUMN)
    @Nonnull
    Integer getRepositoryId();

    @NotNull
    @Accessor(ENABLED_COLUMN)
    boolean isEnabled();

    @Mutator(ENABLED_COLUMN)
    void setEnabled(boolean enabled);


    @Accessor(DEVELOPMENT_BRANCH_REF_ID_COLUMN)
    @StringLength(StringLength.MAX_LENGTH)
    String getDevelopmentBranchId();

    @Mutator(DEVELOPMENT_BRANCH_REF_ID_COLUMN)
    void setDevelopmentBranchId(String developmentBranchId);

    @NotNull
    @Accessor(DEVELOPMENT_BRANCH_USE_DEFAULT_COLUMN)
    boolean isDevelopmentBranchUseDefault();

    @Mutator(DEVELOPMENT_BRANCH_USE_DEFAULT_COLUMN)
    void setDevelopmentBranchUseDefault(boolean useDefault);


    @Accessor(PRODUCTION_BRANCH_REF_ID_COLUMN)
    @StringLength(StringLength.MAX_LENGTH)
    String getProductionBranchId();

    @Mutator(PRODUCTION_BRANCH_REF_ID_COLUMN)
    void setProductionBranchId(String productionBranchId);

    @NotNull
    @Accessor(PRODUCTION_BRANCH_USE_DEFAULT_COLUMN)
    boolean isProductionBranchUseDefault();

    @Mutator(PRODUCTION_BRANCH_USE_DEFAULT_COLUMN)
    void setProductionBranchUseDefault(boolean useDefault);
}
