package models

import "time"

type Repository struct {
	ID            int64     `xorm:"'id' pk autoincr"                             json:"id"`
	OwnerID       int64     `xorm:"'owner_id' index"                             json:"ownerId"`       // user ID; 0 when workspace-owned
	WorkspaceID   *int64    `xorm:"'workspace_id' index"                         json:"workspaceId"`   // set when workspace-owned
	Name          string    `xorm:"'name' notnull varchar(100)"                  json:"name"`
	Description   string    `xorm:"'description' varchar(500)"                   json:"description"`
	IsPrivate     bool      `xorm:"'is_private' default false"                   json:"isPrivate"`
	DefaultBranch string    `xorm:"'default_branch' default 'main' varchar(255)" json:"defaultBranch"`
	DiskPath      string    `xorm:"'disk_path' notnull"                          json:"-"`
	ForkedFrom    string    `xorm:"'forked_from' varchar(500)"                   json:"forkedFrom,omitempty"` // APID of the upstream repo
	CreatedAt     time.Time `xorm:"'created_at' created"                         json:"createdAt"`
	UpdatedAt     time.Time `xorm:"'updated_at' updated"                         json:"updatedAt"`
}
