package com.atlassian.bitbucket.internal.mirroring.mirror.dao.v0;

import net.java.ao.Accessor;
import net.java.ao.Preload;
import net.java.ao.RawEntity;
import net.java.ao.schema.*;

import java.util.Date;

import static com.atlassian.bitbucket.internal.mirroring.mirror.dao.v0.AoConstantsV0.*;

@Table(AoUpstreamServerV0.TABLE_NAME)
@Preload
public interface AoUpstreamServerV0 extends RawEntity<String> {

    String TABLE_NAME = "UPSTREAM_SERVER";

    @NotNull
    @Unique
    @Accessor(BASE_URL_COLUMN)
    @StringLength(LONG_STRING_COLUMN_LENGTH)
    String getBaseUrl();

    @Accessor(ISSUER_ID_COLUMN)
    @StringLength(DEFAULT_STRING_COLUMN_LENGTH)
    String getIssuerId();

    @NotNull
    @PrimaryKey(ID_COLUMN)
    @StringLength(DEFAULT_STRING_COLUMN_LENGTH)
    String getId();

    @Accessor(LAST_SETTINGS_CHANGE_DATE_COLUMN)
    Date getLastSettingsChangeDate();

    @Accessor(LAST_FULL_SYNC_DATE_COLUMN)
    Date getLastFullSyncDate();

    @NotNull
    @Unique
    @Accessor(NAMESPACE_COLUMN)
    @StringLength(DEFAULT_STRING_COLUMN_LENGTH)
    String getNamespace();

    @Indexed
    @Accessor(SHARED_SECRET_COLUMN)
    @StringLength(LONG_STRING_COLUMN_LENGTH)
    String getSharedSecret();

    @NotNull
    @Accessor(STATE_COLUMN)
    IntegrationStateV0 getState();
}
