package models

import "time"

type PRStatus string

const (
	PRStatusOpen   PRStatus = "open"
	PRStatusMerged PRStatus = "merged"
	PRStatusClosed PRStatus = "closed"
)

type PullRequest struct {
	ID           int64     `xorm:"'id' pk autoincr"                         json:"id"`
	RepoID       int64     `xorm:"'repo_id' notnull index"                  json:"repoId"`
	AuthorID     int64     `xorm:"'author_id' notnull index"                json:"authorId"`
	Title        string    `xorm:"'title' notnull varchar(255)"             json:"title"`
	Body         string    `xorm:"'body' text"                              json:"body"`
	SourceBranch string    `xorm:"'source_branch' notnull varchar(255)"     json:"sourceBranch"`
	TargetBranch string    `xorm:"'target_branch' default 'main' varchar(255)" json:"targetBranch"`
	Status       PRStatus  `xorm:"'status' default 'open' varchar(16)"      json:"status"`
	CreatedAt    time.Time `xorm:"'created_at' created"                     json:"createdAt"`
	UpdatedAt    time.Time `xorm:"'updated_at' updated"                     json:"updatedAt"`
}
