package com.atlassian.stash.internal.build.dao;

import com.atlassian.bitbucket.build.BuildState;
import com.atlassian.bitbucket.build.BuildStatus;
import net.java.ao.Accessor;
import net.java.ao.Preload;
import net.java.ao.RawEntity;
import net.java.ao.schema.*;

import javax.annotation.Nullable;
import java.util.Date;

@Table("BUILD_STATUS")
@Preload
public interface AoBuildStatus extends BuildStatus, RawEntity<Integer> {

    String ID = "ID";
    String COMMIT_ID = "CSID";
    String STATE = "STATE";
    String KEY = "KEY";
    String NAME = "NAME";
    String URL = "URL";
    String DESCRIPTION = "DESCRIPTION";
    String DATE_ADDED = "DATE_ADDED";

    int MAX_DESCRIPTION = 255;
    int MAX_FIELDS = 255;

    @AutoIncrement
    @NotNull
    @PrimaryKey(ID)
    Integer getId();

    @NotNull
    @Accessor(COMMIT_ID)
    @StringLength(40)
    @Indexed
    String getCommitId();

    @NotNull
    @Accessor(STATE)
    BuildState getState();

    @NotNull
    @Accessor(KEY)
    @StringLength(MAX_FIELDS)
    String getKey();

    @Nullable
    @Accessor(NAME)
    @StringLength(MAX_FIELDS)
    String getName();

    @NotNull
    @Accessor(URL)
    @StringLength(StringLength.MAX_LENGTH)
    String getUrl();

    @Nullable
    @Accessor(DESCRIPTION)
    @StringLength(MAX_DESCRIPTION)
    String getDescription();

    @NotNull
    @Accessor(DATE_ADDED)
    Date getDateAdded();

}
