package github

import (
	"time"

	"github.com/tidbcloud/devops/models/base"
)

type GithubPullRequest struct {
	ID base.ID `gorm:"primary_key;not null"`

	Location  string    `gorm:"type:VARCHAR(255);not null;uniqueIndex:idx_location"` // owner/repo#number
	Owner     string    `gorm:"type:VARCHAR(255);not null"`
	Repo      string    `gorm:"type:VARCHAR(255);not null"`
	Number    int64     `gorm:"not null"`
	Title     string    `gorm:"type:VARCHAR(512);not null"`
	Author    string    `gorm:"type:VARCHAR(100);not null"`
	State     string    `gorm:"type:VARCHAR(50);not null"`
	CreatedAt time.Time `gorm:"type:TIMESTAMP;autoCreateTime:false"`
	UpdatedAt time.Time `gorm:"type:TIMESTAMP;autoUpdateTime:false"`
}

type GithubRepository struct {
	ID base.ID `gorm:"primary_key;not null"`

	Location  string    `gorm:"type:VARCHAR(255);not null;uniqueIndex:idx_location"` // owner/repo
	Owner     string    `gorm:"type:VARCHAR(255);not null"`
	Name      string    `gorm:"type:VARCHAR(255);not null"`
	UpdatedAt time.Time `gorm:"type:TIMESTAMP;autoUpdateTime:false"`
	PushedAt  time.Time `gorm:"type:TIMESTAMP"`
}
