package models

import "time"

// SecretLeak records a detected secret pattern in a pushed commit.
// When a match is confirmed not to be a real secret, set Dismissed=true.
type SecretLeak struct {
	ID          int64      `xorm:"'id' pk autoincr"              json:"id"`
	RepoID      int64      `xorm:"'repo_id' notnull index"       json:"repoId"`
	CommitSHA   string     `xorm:"'commit_sha' varchar(12)"      json:"commitSha"`
	Ref         string     `xorm:"'ref' varchar(255)"            json:"ref"`
	PatternName string     `xorm:"'pattern_name' varchar(50)"    json:"patternName"`
	Description string     `xorm:"'description' varchar(200)"    json:"description"`
	Severity    string     `xorm:"'severity' varchar(10)"        json:"severity"`
	MatchSample string     `xorm:"'match_sample' varchar(60)"    json:"matchSample"`
	Dismissed   bool       `xorm:"'dismissed'"                   json:"dismissed"`
	DismissedBy string     `xorm:"'dismissed_by' varchar(100)"   json:"dismissedBy,omitempty"`
	DismissedAt *time.Time `xorm:"'dismissed_at'"                json:"dismissedAt,omitempty"`
	DetectedAt  time.Time  `xorm:"'detected_at'"                 json:"detectedAt"`
}
