package models import ( "encoding/json" "time" "github.com/google/uuid" ) type OAuthClient struct { ID uuid.UUID `db:"id" json:"id"` ClientID string `db:"client_id" json:"client_id"` ClientSecret string `db:"client_secret" json:"client_secret"` Name string `db:"name" json:"name"` RedirectURIs json.RawMessage `db:"redirect_uris" json:"redirect_uris"` GrantTypes json.RawMessage `db:"grant_types" json:"grant_types"` Scopes json.RawMessage `db:"scopes" json:"scopes,omitempty"` IsActive bool `db:"is_active" json:"is_active"` Trusted bool `db:"trusted" json:"trusted"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` } type RefreshTokenRow struct { ID uuid.UUID `db:"id"` TokenHash string `db:"token_hash"` UserID uuid.UUID `db:"user_id"` ClientID uuid.UUID `db:"client_id"` Scopes json.RawMessage `db:"scopes"` ExpiresAt time.Time `db:"expires_at"` CreatedAt time.Time `db:"created_at"` } type AuthorizationCodeRow struct { ID uuid.UUID `db:"id"` CodeHash string `db:"code_hash"` UserID uuid.UUID `db:"user_id"` ClientID uuid.UUID `db:"client_id"` RedirectURI string `db:"redirect_uri"` Scopes json.RawMessage `db:"scopes"` CodeChallenge string `db:"code_challenge"` CodeChallengeMethod string `db:"code_challenge_method"` ExpiresAt time.Time `db:"expires_at"` ConsumedAt *time.Time `db:"consumed_at"` CreatedAt time.Time `db:"created_at"` } type UserConsent struct { ID uuid.UUID `json:"id"` UserID uuid.UUID `json:"-"` ClientID uuid.UUID `json:"-"` ClientIdentifier string `json:"client_id"` ClientName string `json:"client_name"` Scopes []string `json:"scopes"` AuthorizedAt time.Time `json:"authorized_at"` LastUsedAt *time.Time `json:"last_used_at,omitempty"` RevokedAt *time.Time `json:"revoked_at,omitempty"` }