import Foundation
import GRDB

public struct PendingActionRecord: Codable, FetchableRecord, PersistableRecord, Sendable {
	public static let databaseTableName = "pendingAction"

	public var id: String
	public var accountId: String
	public var actionType: String
	public var payload: String
	public var createdAt: String
	public var retryCount: Int
	public var lastError: String?

	public init(
		id: String,
		accountId: String,
		actionType: String,
		payload: String,
		createdAt: String,
		retryCount: Int = 0,
		lastError: String? = nil
	) {
		self.id = id
		self.accountId = accountId
		self.actionType = actionType
		self.payload = payload
		self.createdAt = createdAt
		self.retryCount = retryCount
		self.lastError = lastError
	}
}
