/// PosgreSQL specific `PostgreSQLPrimaryKey.swift`.
public enum PostgreSQLPrimaryKeyDefault: SQLPrimaryKeyDefault {
    /// `GENERATED BY` methods.
    public enum Generated {
        /// `BY DEFAULT`
        case byDefault
        /// `ALWAYS`
        case always
    }
    
    /// `GENERATED BY`
    case generated(Generated)
    
    /// Default primary key value.
    public static var `default`: PostgreSQLPrimaryKeyDefault {
        return .generated(.byDefault)
    }
    
    /// See `SQLSerializable`.
    public func serialize(_ binds: inout [Encodable]) -> String {
        switch self {
        case .generated(let generated):
            switch generated {
            case .always: return "GENERATED ALWAYS AS IDENTITY"
            case .byDefault: return "GENERATED BY DEFAULT AS IDENTITY"
            }
        }
    }
}
