# @aurora-catalyst-generated
# @source cliter/o-auth/refresh-token.aurora.yaml

type OAuthRefreshToken {
  """
  Unique identifier for the refresh token. UUID v4 format, generated automatically on creation.
  """
  id: ID!
  """
  Auto-incrementing row identifier. Used for internal ordering and as a numeric alternative to UUID.
  """
  rowId: GraphQLInt!
  """
  ID of the associated access token. One-to-one relationship ensures each refresh token is tied to a specific access token instance.
  """
  accessTokenId: ID!
  accessToken: OAuthAccessToken
  """
  The refresh token string. JWT or opaque token value. SECURITY: Must be stored securely and treated as a sensitive credential. Used to request new access tokens.
  """
  token: GraphQLString!
  """
  Indicates whether the refresh token has been revoked. Revoked tokens cannot be used to obtain new access tokens. Set to true on logout or security events.
  """
  isRevoked: GraphQLBoolean!
  """
  Expiration timestamp for the refresh token. After this time, the token cannot be used to obtain new access tokens. NULL means no expiration (not recommended for security).
  """
  expiresAt: GraphQLTimestamp
  """
  Timestamp when the refresh token was created. Automatically set on creation.
  """
  createdAt: GraphQLTimestamp
  """
  Timestamp when the refresh token was last updated. Automatically updated on modification.
  """
  updatedAt: GraphQLTimestamp
  """
  Soft delete timestamp. NULL means active token. When set, token is excluded from normal queries but preserved for audit trail.
  """
  deletedAt: GraphQLTimestamp
}

input OAuthCreateRefreshTokenInput {
  id: ID!
  accessTokenId: ID!
  token: GraphQLString!
  isRevoked: GraphQLBoolean!
  expiresAt: GraphQLTimestamp
}

input OAuthUpdateRefreshTokenByIdInput {
  id: ID!
  accessTokenId: ID
  token: GraphQLString
  isRevoked: GraphQLBoolean
  expiresAt: GraphQLTimestamp
}

input OAuthUpdateRefreshTokensInput {
  id: ID
  accessTokenId: ID
  token: GraphQLString
  isRevoked: GraphQLBoolean
  expiresAt: GraphQLTimestamp
}
type Query {
  oAuthFindRefreshToken(query: QueryStatement, constraint: QueryStatement): OAuthRefreshToken

  oAuthFindRefreshTokenById(id: ID, constraint: QueryStatement): OAuthRefreshToken

  oAuthGetRefreshTokens(query: QueryStatement, constraint: QueryStatement): [OAuthRefreshToken]!

  oAuthPaginateRefreshTokens(query: QueryStatement, constraint: QueryStatement): Pagination!
}

type Mutation {
  oAuthDeleteRefreshTokenById(id: ID!, constraint: QueryStatement): OAuthRefreshToken
}
